ordering-ui-admin-external 1.32.3 → 1.33.1
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.4f45fe63ec89421145a4.js → ordering-ui-admin.462f5c3aad7a320965e9.js} +2 -2
- package/_modules/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/index.js +1 -6
- package/_modules/components/BusinessIntelligence/AnalyticsSpendList/index.js +1 -6
- package/_modules/components/Delivery/DriversGroupLogs/index.js +14 -1
- package/_modules/components/Delivery/DriversGroupLogs/styles.js +3 -3
- package/_modules/components/Delivery/UserDetails/index.js +5 -2
- package/_modules/components/Delivery/UserDetailsMenu/index.js +3 -0
- package/_modules/components/OrderingProducts/SiteTheme/ThemeOption.js +22 -4
- package/_modules/components/Orders/AllInOne/DriversManager/styles.js +1 -1
- package/_modules/components/Orders/AllInOne/index.js +0 -1
- package/_modules/components/Orders/CreateCustomOrder/index.js +4 -2
- package/_modules/components/Orders/DriverMapMarkerAndInfo/index.js +1 -3
- package/_modules/components/Orders/DriversList/index.js +10 -4
- package/_modules/components/Orders/DriversList/styles.js +18 -12
- package/_modules/components/Orders/OrderBill/RefundToWallet.js +31 -12
- package/_modules/components/Orders/OrderBill/index.js +7 -3
- package/_modules/components/Orders/OrderContactInformation/index.js +113 -19
- package/_modules/components/Orders/OrderContactInformation/styles.js +34 -12
- package/_modules/components/Orders/OrderDetails/index.js +48 -5
- package/_modules/components/Orders/OrderDetails/styles.js +19 -4
- package/_modules/components/Orders/OrdersContentHeader/index.js +8 -42
- package/_modules/components/Orders/OrdersContentHeader/styles.js +3 -19
- package/_modules/components/Orders/OrdersDashboardControls/index.js +4 -2
- package/_modules/components/Orders/OrdersFilterGroup/index.js +46 -9
- package/_modules/components/Orders/OrdersFilterGroup/styles.js +19 -3
- package/_modules/components/Orders/OrdersManager/index.js +2 -2
- package/_modules/components/Profile/ProfilePage/index.js +6 -1
- package/_modules/components/Profile/ProfilePage/styles.js +11 -8
- package/_modules/components/Settings/GuestCheckoutFieldsSetting/index.js +135 -0
- package/_modules/components/Settings/GuestCheckoutFieldsSetting/styles.js +51 -0
- package/_modules/components/Settings/Settings/index.js +13 -2
- package/_modules/components/Settings/index.js +8 -1
- package/_modules/components/Shared/PushTokens/index.js +77 -0
- package/_modules/components/Shared/PushTokens/styles.js +25 -0
- package/_modules/components/Shared/index.js +7 -0
- package/_modules/components/Stores/BusinessDeviceDetail/index.js +2 -1
- package/_modules/components/Stores/ProductIngredient/index.js +2 -2
- package/_modules/components/Users/UserDetails/index.js +5 -2
- package/_modules/components/Users/UserDetailsMenu/index.js +3 -0
- package/index-template.js +4 -2
- package/index.html +2 -2
- package/package.json +2 -2
- package/src/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/index.js +2 -3
- package/src/components/BusinessIntelligence/AnalyticsSpendList/index.js +2 -3
- package/src/components/Delivery/DriversGroupLogs/index.js +9 -5
- package/src/components/Delivery/DriversGroupLogs/styles.js +3 -1
- package/src/components/Delivery/UserDetails/index.js +7 -1
- package/src/components/Delivery/UserDetailsMenu/index.js +2 -1
- package/src/components/OrderingProducts/SiteTheme/ThemeOption.js +23 -3
- package/src/components/Orders/AllInOne/DriversManager/styles.js +7 -1
- package/src/components/Orders/AllInOne/index.js +0 -1
- package/src/components/Orders/CreateCustomOrder/index.js +3 -1
- package/src/components/Orders/DriverMapMarkerAndInfo/index.js +1 -1
- package/src/components/Orders/DriversList/index.js +18 -14
- package/src/components/Orders/DriversList/styles.js +15 -6
- package/src/components/Orders/OrderBill/RefundToWallet.js +25 -10
- package/src/components/Orders/OrderBill/index.js +2 -1
- package/src/components/Orders/OrderContactInformation/index.js +155 -68
- package/src/components/Orders/OrderContactInformation/styles.js +67 -0
- package/src/components/Orders/OrderDetails/index.js +55 -10
- package/src/components/Orders/OrderDetails/styles.js +33 -1
- package/src/components/Orders/OrdersContentHeader/index.js +16 -52
- package/src/components/Orders/OrdersContentHeader/styles.js +0 -53
- package/src/components/Orders/OrdersDashboardControls/index.js +3 -2
- package/src/components/Orders/OrdersFilterGroup/index.js +226 -183
- package/src/components/Orders/OrdersFilterGroup/styles.js +53 -0
- package/src/components/Orders/OrdersManager/index.js +1 -1
- package/src/components/Profile/ProfilePage/index.js +4 -1
- package/src/components/Profile/ProfilePage/styles.js +9 -0
- package/src/components/Settings/GuestCheckoutFieldsSetting/index.js +116 -0
- package/src/components/Settings/GuestCheckoutFieldsSetting/styles.js +164 -0
- package/src/components/Settings/Settings/index.js +16 -1
- package/src/components/Settings/index.js +3 -1
- package/src/components/Shared/PushTokens/index.js +87 -0
- package/src/components/Shared/PushTokens/styles.js +64 -0
- package/src/components/Shared/index.js +2 -0
- package/src/components/Stores/BusinessDeviceDetail/index.js +1 -0
- package/src/components/Stores/ProductIngredient/index.js +2 -2
- package/src/components/Users/UserDetails/index.js +7 -1
- package/src/components/Users/UserDetailsMenu/index.js +2 -1
- package/template/assets/images/google-calendar-icon.png +0 -0
- package/template/pages/CustomersList/index.js +1 -1
- package/template/pages/ManagersList/index.js +1 -1
- /package/_bundles/{ordering-ui-admin.4f45fe63ec89421145a4.js.LICENSE.txt → ordering-ui-admin.462f5c3aad7a320965e9.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React, { useState, useMemo } from 'react'
|
|
2
|
+
import { useLanguage, useConfig, GuestCheckoutFieldsSetting as GuestCheckoutFieldsSettingController } from 'ordering-components-admin-external'
|
|
3
|
+
import { DefaultSelect, IconButton, Switch } from '../../../styles'
|
|
4
|
+
import Skeleton from 'react-loading-skeleton'
|
|
5
|
+
import { InfoCircle } from 'react-bootstrap-icons'
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
CheckoutFieldsDetailsContainer,
|
|
9
|
+
FieldContainer,
|
|
10
|
+
SelectWrapper,
|
|
11
|
+
Option,
|
|
12
|
+
TitleWrapper,
|
|
13
|
+
InfoWrapper,
|
|
14
|
+
InfoContent
|
|
15
|
+
} from './styles'
|
|
16
|
+
|
|
17
|
+
const GuestCheckoutFieldsSettingUI = (props) => {
|
|
18
|
+
const {
|
|
19
|
+
checkoutFieldsState,
|
|
20
|
+
handleChangeCheckoutFieldSetting
|
|
21
|
+
} = props
|
|
22
|
+
|
|
23
|
+
const [, t] = useLanguage()
|
|
24
|
+
const [{ configs }] = useConfig()
|
|
25
|
+
|
|
26
|
+
const [orderType, setOrderType] = useState('1')
|
|
27
|
+
|
|
28
|
+
const hideSettingList = ['city_dropdown_option', 'address', 'address_notes']
|
|
29
|
+
const orderValidationFields = ['name', 'middle_name', 'lastname', 'second_lastname', 'email', 'mobile_phone', 'city_dropdown_option', 'address', 'zipcode', 'address_notes', 'coupon', 'driver_tip', 'comments', 'birthdate']
|
|
30
|
+
|
|
31
|
+
const orderTypeList = useMemo(() => {
|
|
32
|
+
const orderTypes = configs?.order_types_allowed?.options?.map(item => ({ value: item.value, content: <Option>{t(item.text, item.text?.replace('_', ' ').toLowerCase())}</Option> }))
|
|
33
|
+
return orderTypes || []
|
|
34
|
+
}, [configs?.order_types_allowed])
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<CheckoutFieldsDetailsContainer>
|
|
39
|
+
<TitleWrapper>
|
|
40
|
+
<h1>{t('CHECKOUT_CUSTOMER_FIELDS', 'Checkout and Customer fields')}</h1>
|
|
41
|
+
<InfoWrapper>
|
|
42
|
+
<IconButton
|
|
43
|
+
color='primary'
|
|
44
|
+
>
|
|
45
|
+
<InfoCircle />
|
|
46
|
+
</IconButton>
|
|
47
|
+
<InfoContent>
|
|
48
|
+
{t('GUEST_CHECKOUT_SETTING_INFO', 'Manage the fields that your guest users will be able to select and the fields required to complete an order (These options only apply for guest users)')}
|
|
49
|
+
</InfoContent>
|
|
50
|
+
</InfoWrapper>
|
|
51
|
+
</TitleWrapper>
|
|
52
|
+
<SelectWrapper>
|
|
53
|
+
<label>{t('FRONT_MAIN_EMAIL_ORDER_TYPE', 'Order type')}</label>
|
|
54
|
+
<DefaultSelect
|
|
55
|
+
placeholder={t('SELECT_ORDER_TYPE', 'Select order type')}
|
|
56
|
+
defaultValue={orderType}
|
|
57
|
+
options={orderTypeList}
|
|
58
|
+
onChange={val => setOrderType(val)}
|
|
59
|
+
/>
|
|
60
|
+
</SelectWrapper>
|
|
61
|
+
<FieldContainer isHeader>
|
|
62
|
+
<div className='name'>{t('FIELD', 'Field')}</div>
|
|
63
|
+
<div className='required'>{t('REQUIRED', 'Required')}</div>
|
|
64
|
+
<div className='status'>{t('STATE', 'Status')}</div>
|
|
65
|
+
</FieldContainer>
|
|
66
|
+
{checkoutFieldsState?.loading ? (
|
|
67
|
+
[...Array(10).keys()].map(i => (
|
|
68
|
+
<FieldContainer key={i}>
|
|
69
|
+
<div className='name'><Skeleton width={120} /></div>
|
|
70
|
+
<div className='required'>
|
|
71
|
+
<Skeleton width={30} style={{ borderRadius: 20 }} />
|
|
72
|
+
</div>
|
|
73
|
+
<div className='status'>
|
|
74
|
+
<Skeleton width={30} style={{ borderRadius: 20 }} />
|
|
75
|
+
</div>
|
|
76
|
+
</FieldContainer>
|
|
77
|
+
))
|
|
78
|
+
) : (
|
|
79
|
+
<>
|
|
80
|
+
{checkoutFieldsState.fields
|
|
81
|
+
.filter(item => item?.order_type_id === parseInt(orderType))
|
|
82
|
+
.sort((a, b) => {
|
|
83
|
+
const indexA = orderValidationFields.indexOf(a?.validation_field.code)
|
|
84
|
+
const indexB = orderValidationFields.indexOf(b?.validation_field.code)
|
|
85
|
+
return indexA - indexB
|
|
86
|
+
})
|
|
87
|
+
.map(field => !hideSettingList.includes(field?.validation_field.code) && !([2, 3, 4, 5, 6].includes(field?.order_type_id) && field?.validation_field.code === 'driver_tip') && (
|
|
88
|
+
<FieldContainer key={field.id}>
|
|
89
|
+
<div className='name'>{t(field?.validation_field.code.toUpperCase(), field?.validation_field.name)}</div>
|
|
90
|
+
<div className='required'>
|
|
91
|
+
<Switch
|
|
92
|
+
defaultChecked={field?.required}
|
|
93
|
+
onChange={(val) => handleChangeCheckoutFieldSetting(field?.validation_field_id, field?.order_type_id, { required: val })}
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
<div className='status'>
|
|
97
|
+
<Switch
|
|
98
|
+
defaultChecked={field?.enabled}
|
|
99
|
+
onChange={(val) => handleChangeCheckoutFieldSetting(field?.validation_field_id, field?.order_type_id, { enabled: val })}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</FieldContainer>
|
|
103
|
+
))}
|
|
104
|
+
</>
|
|
105
|
+
)}
|
|
106
|
+
</CheckoutFieldsDetailsContainer>
|
|
107
|
+
</>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
export const GuestCheckoutFieldsSetting = (props) => {
|
|
111
|
+
const guestCheckoutFieldsSettingProps = {
|
|
112
|
+
...props,
|
|
113
|
+
UIComponent: GuestCheckoutFieldsSettingUI
|
|
114
|
+
}
|
|
115
|
+
return <GuestCheckoutFieldsSettingController {...guestCheckoutFieldsSettingProps} />
|
|
116
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const CheckoutFieldsDetailsContainer = styled.div`
|
|
4
|
+
padding: 26px 15px;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: 100%;
|
|
7
|
+
overflow-x: hidden;
|
|
8
|
+
|
|
9
|
+
@media (min-width: 768px) {
|
|
10
|
+
padding: 26px 40px;
|
|
11
|
+
}
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
export const SelectWrapper = styled.div`
|
|
15
|
+
margin-top: 25px;
|
|
16
|
+
margin-bottom: 20px;
|
|
17
|
+
label {
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
line-height: 24px;
|
|
21
|
+
margin-bottom: 10px;
|
|
22
|
+
}
|
|
23
|
+
> div {
|
|
24
|
+
width: 100%;
|
|
25
|
+
border: none;
|
|
26
|
+
|
|
27
|
+
> div:first-child {
|
|
28
|
+
background-color: ${props => props.theme.colors.secundary};
|
|
29
|
+
height: 43px;
|
|
30
|
+
border: none;
|
|
31
|
+
border-radius: 7.6px;
|
|
32
|
+
font-weight: 400;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
line-height: 24px;
|
|
35
|
+
color: ${props => props.theme.colors.secundaryContrast};
|
|
36
|
+
}
|
|
37
|
+
.list {
|
|
38
|
+
background-color: ${props => props.theme.colors.secundary};
|
|
39
|
+
border: none;
|
|
40
|
+
|
|
41
|
+
.list-wrapper {
|
|
42
|
+
> div {
|
|
43
|
+
padding: 6px 10px;
|
|
44
|
+
&:hover {
|
|
45
|
+
background-color: #f2f5f7;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`
|
|
52
|
+
|
|
53
|
+
export const Option = styled.div`
|
|
54
|
+
font-weight: 400;
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
line-height: 24px;
|
|
57
|
+
color: ${props => props.theme.colors.secundaryContrast};
|
|
58
|
+
text-transform: lowercase;
|
|
59
|
+
&::first-letter {
|
|
60
|
+
text-transform: uppercase;
|
|
61
|
+
}
|
|
62
|
+
`
|
|
63
|
+
|
|
64
|
+
export const FieldContainer = styled.div`
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
padding: 10px 0;
|
|
68
|
+
${({ isHeader }) => isHeader && css`
|
|
69
|
+
border-bottom: 1px solid ${props => props.theme.colors.borderColor};
|
|
70
|
+
margin-bottom: 15px;
|
|
71
|
+
> div {
|
|
72
|
+
font-weight: 700;
|
|
73
|
+
font-size: 14px;
|
|
74
|
+
}
|
|
75
|
+
`}
|
|
76
|
+
|
|
77
|
+
.name {
|
|
78
|
+
flex: 1;
|
|
79
|
+
font-size: 14px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.required {
|
|
83
|
+
width: 80px;
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
align-items: center;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.status {
|
|
90
|
+
width: 80px;
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
align-items: center;
|
|
94
|
+
}
|
|
95
|
+
`
|
|
96
|
+
|
|
97
|
+
export const TitleWrapper = styled.div`
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
margin-bottom: 10px;
|
|
101
|
+
${props => props.theme?.rtl ? css`
|
|
102
|
+
margin-left: 40px;
|
|
103
|
+
` : css`
|
|
104
|
+
margin-right: 40px;
|
|
105
|
+
`}
|
|
106
|
+
|
|
107
|
+
h1 {
|
|
108
|
+
font-weight: 700;
|
|
109
|
+
font-size: 20px;
|
|
110
|
+
margin-bottom: 0;
|
|
111
|
+
}
|
|
112
|
+
`
|
|
113
|
+
|
|
114
|
+
export const InfoWrapper = styled.div`
|
|
115
|
+
position: relative;
|
|
116
|
+
${props => props.theme?.rtl ? css`
|
|
117
|
+
margin-left: -8px;
|
|
118
|
+
margin-right: 8px;
|
|
119
|
+
` : css`
|
|
120
|
+
margin-right: -8px;
|
|
121
|
+
margin-left: 8px;
|
|
122
|
+
`}
|
|
123
|
+
|
|
124
|
+
> button {
|
|
125
|
+
height: 25px;
|
|
126
|
+
svg {
|
|
127
|
+
width: 16px;
|
|
128
|
+
height: 16px;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
&:hover > div {
|
|
132
|
+
/* display: block; */
|
|
133
|
+
visibility: visible;
|
|
134
|
+
opacity: 1;
|
|
135
|
+
}
|
|
136
|
+
`
|
|
137
|
+
|
|
138
|
+
export const InfoContent = styled.div`
|
|
139
|
+
position: absolute;
|
|
140
|
+
top: 100%;
|
|
141
|
+
z-index: 999;
|
|
142
|
+
background: ${props => props.theme.colors.backgroundInfo};
|
|
143
|
+
border: 1px solid ${props => props.theme.colors.primary};
|
|
144
|
+
box-sizing: border-box;
|
|
145
|
+
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.12);
|
|
146
|
+
border-radius: 7.6px;
|
|
147
|
+
padding: 8px 12px;
|
|
148
|
+
font-size: 12px;
|
|
149
|
+
line-height: 18px;
|
|
150
|
+
min-width: 150px;
|
|
151
|
+
transition: all 0.3s linear;
|
|
152
|
+
visibility: hidden;
|
|
153
|
+
opacity: 0;
|
|
154
|
+
right: 0px;
|
|
155
|
+
${props => props.theme.rtl && css`
|
|
156
|
+
left: 0px;
|
|
157
|
+
right: initial;
|
|
158
|
+
`}
|
|
159
|
+
|
|
160
|
+
@media (min-width: 576px) {
|
|
161
|
+
min-width: 330px;
|
|
162
|
+
padding: 12px 15px;
|
|
163
|
+
}
|
|
164
|
+
`
|
|
@@ -13,6 +13,8 @@ import { AddressFieldsSetting } from '../AddressFieldsSetting'
|
|
|
13
13
|
import { LanguageSetting } from '../LanguageSetting'
|
|
14
14
|
import { SitesAuthSettings } from '../SitesAuthSettings'
|
|
15
15
|
import { MultiCountrySettings } from '../MultiCountrySettings'
|
|
16
|
+
import { CardFieldsSetting } from '../CardFieldsSetting'
|
|
17
|
+
import { GuestCheckoutFieldsSetting } from '../GuestCheckoutFieldsSetting'
|
|
16
18
|
|
|
17
19
|
import {
|
|
18
20
|
BasicSettingsContainer,
|
|
@@ -24,7 +26,6 @@ import {
|
|
|
24
26
|
InfoWrapper,
|
|
25
27
|
InfoContent
|
|
26
28
|
} from './styles'
|
|
27
|
-
import { CardFieldsSetting } from '../CardFieldsSetting'
|
|
28
29
|
|
|
29
30
|
const SettingsUI = (props) => {
|
|
30
31
|
const {
|
|
@@ -198,6 +199,17 @@ const SettingsUI = (props) => {
|
|
|
198
199
|
active={isOpenSettingDetails === 'checkout'}
|
|
199
200
|
/>
|
|
200
201
|
</SettingItemWrapper>
|
|
202
|
+
<SettingItemWrapper
|
|
203
|
+
className='col-md-4 col-sm-6'
|
|
204
|
+
onClick={() => handleOpenSettingDetails('guest_checkout')}
|
|
205
|
+
>
|
|
206
|
+
<SettingItemUI
|
|
207
|
+
title={t('GUEST_CHECKOUT_FIELDS', 'Guest checkout fields')}
|
|
208
|
+
description={t('GUEST_CHECKOUT_FIELDS_DESC', 'Which fields do you want to show on the guest checkout page?')}
|
|
209
|
+
icon={<CheckCircleFill />}
|
|
210
|
+
active={isOpenSettingDetails === 'guest_checkout'}
|
|
211
|
+
/>
|
|
212
|
+
</SettingItemWrapper>
|
|
201
213
|
<SettingItemWrapper
|
|
202
214
|
className='col-md-4 col-sm-6'
|
|
203
215
|
onClick={() => handleOpenSettingDetails('address')}
|
|
@@ -324,6 +336,9 @@ const SettingsUI = (props) => {
|
|
|
324
336
|
{isOpenSettingDetails === 'checkout' && (
|
|
325
337
|
<CheckoutFieldsSetting />
|
|
326
338
|
)}
|
|
339
|
+
{isOpenSettingDetails === 'guest_checkout' && (
|
|
340
|
+
<GuestCheckoutFieldsSetting />
|
|
341
|
+
)}
|
|
327
342
|
{isOpenSettingDetails === 'address' && (
|
|
328
343
|
<AddressFieldsSetting />
|
|
329
344
|
)}
|
|
@@ -32,6 +32,7 @@ import { LanguageTransSpread } from './LanguageTransSpread'
|
|
|
32
32
|
import { LanguageTransTable } from './LanguageTransTable'
|
|
33
33
|
import { MultiCountrySettings } from './MultiCountrySettings'
|
|
34
34
|
import { CardFieldsSetting } from './CardFieldsSetting'
|
|
35
|
+
import { GuestCheckoutFieldsSetting } from './GuestCheckoutFieldsSetting'
|
|
35
36
|
export {
|
|
36
37
|
Cms,
|
|
37
38
|
IntegrationListing,
|
|
@@ -66,5 +67,6 @@ export {
|
|
|
66
67
|
LanguageTransSpread,
|
|
67
68
|
LanguageTransTable,
|
|
68
69
|
MultiCountrySettings,
|
|
69
|
-
CardFieldsSetting
|
|
70
|
+
CardFieldsSetting,
|
|
71
|
+
GuestCheckoutFieldsSetting
|
|
70
72
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React, { useMemo, useState, useEffect } from 'react'
|
|
2
|
+
import { useLanguage, useUtils } from 'ordering-components-admin-external'
|
|
3
|
+
import { Pagination } from '../Pagination'
|
|
4
|
+
import {
|
|
5
|
+
Container,
|
|
6
|
+
TableWrapper,
|
|
7
|
+
Table,
|
|
8
|
+
WrapperPagination
|
|
9
|
+
} from './styles'
|
|
10
|
+
|
|
11
|
+
export const PushTokens = (props) => {
|
|
12
|
+
const {
|
|
13
|
+
userId,
|
|
14
|
+
pushTokens
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
const [, t] = useLanguage()
|
|
18
|
+
const [{ parseDate }] = useUtils()
|
|
19
|
+
|
|
20
|
+
const numberPerPage = 10
|
|
21
|
+
const [currentPage, setCurrentPage] = useState(1)
|
|
22
|
+
const [currentPageTokens, setCurrentPageTokens] = useState([])
|
|
23
|
+
|
|
24
|
+
const sortedTokens = useMemo(() => {
|
|
25
|
+
const _tokens = [...pushTokens]
|
|
26
|
+
return _tokens.sort((a, b) => b.id - a.id)
|
|
27
|
+
}, [pushTokens])
|
|
28
|
+
|
|
29
|
+
const handleChangePage = (pageNumber) => {
|
|
30
|
+
setCurrentPage(pageNumber)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const indexOfLastPost = currentPage * numberPerPage
|
|
35
|
+
const indexOfFirstPost = indexOfLastPost - numberPerPage
|
|
36
|
+
const _currentProducts = sortedTokens.slice(indexOfFirstPost, indexOfLastPost)
|
|
37
|
+
setCurrentPageTokens(_currentProducts)
|
|
38
|
+
}, [sortedTokens, currentPage])
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
setCurrentPage(1)
|
|
42
|
+
}, [userId])
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Container>
|
|
46
|
+
{sortedTokens.length > 0 ? (
|
|
47
|
+
<TableWrapper>
|
|
48
|
+
<Table>
|
|
49
|
+
<thead>
|
|
50
|
+
<tr>
|
|
51
|
+
<th>{t('USER_ID_NUMBER', 'User ID')}</th>
|
|
52
|
+
<th>{t('TOKEN', 'Token')}</th>
|
|
53
|
+
<th>{t('APP', 'App')}</th>
|
|
54
|
+
<th>{t('CREATED_AT', 'Created at')}</th>
|
|
55
|
+
<th>{t('UPDATED_AT', 'Updated at')}</th>
|
|
56
|
+
</tr>
|
|
57
|
+
</thead>
|
|
58
|
+
{currentPageTokens.map(token => (
|
|
59
|
+
<tbody key={token.id}>
|
|
60
|
+
<tr>
|
|
61
|
+
<td>{token?.user_id}</td>
|
|
62
|
+
<td>{token?.token}</td>
|
|
63
|
+
<td>{token?.app}</td>
|
|
64
|
+
<td>{parseDate(token?.created_at, { utc: false })}</td>
|
|
65
|
+
<td>{parseDate(token?.updated_at, { utc: false })}</td>
|
|
66
|
+
</tr>
|
|
67
|
+
</tbody>
|
|
68
|
+
))}
|
|
69
|
+
</Table>
|
|
70
|
+
</TableWrapper>
|
|
71
|
+
) : (
|
|
72
|
+
<p className='no-data'>{t('NO_DATA', 'No Data')}</p>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
{sortedTokens?.length > 0 && (
|
|
76
|
+
<WrapperPagination>
|
|
77
|
+
<Pagination
|
|
78
|
+
isHidePagecontrol
|
|
79
|
+
currentPage={currentPage}
|
|
80
|
+
totalPages={Math.ceil(sortedTokens.length / numberPerPage)}
|
|
81
|
+
handleChangePage={handleChangePage}
|
|
82
|
+
/>
|
|
83
|
+
</WrapperPagination>
|
|
84
|
+
)}
|
|
85
|
+
</Container>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const Container = styled.div`
|
|
4
|
+
p.no-data {
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
margin: 20px 0;
|
|
7
|
+
}
|
|
8
|
+
`
|
|
9
|
+
export const TableWrapper = styled.div`
|
|
10
|
+
overflow: auto;
|
|
11
|
+
`
|
|
12
|
+
export const Table = styled.table`
|
|
13
|
+
width: 100%;
|
|
14
|
+
min-width: 900px;
|
|
15
|
+
color: ${props => props.theme.colors?.headingColor};
|
|
16
|
+
|
|
17
|
+
thead {
|
|
18
|
+
tr {
|
|
19
|
+
border-bottom: solid 1px ${props => props.theme.colors.disabled};
|
|
20
|
+
th {
|
|
21
|
+
padding: 13px 0;
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
&:nth-child(2) {
|
|
24
|
+
width: 35%;
|
|
25
|
+
padding-left: 15px;
|
|
26
|
+
padding-right: 15px;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
}
|
|
29
|
+
&:nth-child(3),
|
|
30
|
+
&:nth-child(4),
|
|
31
|
+
&:nth-child(5)
|
|
32
|
+
{
|
|
33
|
+
width: 19%;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
tbody {
|
|
40
|
+
border-bottom: 1px solid ${props => props.theme.colors.borderColor};
|
|
41
|
+
td {
|
|
42
|
+
padding: 13px 0;
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
|
|
45
|
+
&:nth-child(2) {
|
|
46
|
+
width: 35%;
|
|
47
|
+
padding-left: 15px;
|
|
48
|
+
padding-right: 15px;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&:nth-child(3),
|
|
53
|
+
&:nth-child(4),
|
|
54
|
+
&:nth-child(5) {
|
|
55
|
+
width: 19%;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`
|
|
60
|
+
export const WrapperPagination = styled.div`
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
padding: 20px 0;
|
|
64
|
+
`
|
|
@@ -15,6 +15,7 @@ import { Pagination } from './Pagination'
|
|
|
15
15
|
import { PaginationButton } from './PaginationButton'
|
|
16
16
|
import { Personalization } from './Personalization'
|
|
17
17
|
import { ProtectedRoute } from './ProtectedRoute'
|
|
18
|
+
import { PushTokens } from './PushTokens'
|
|
18
19
|
import { Schedule } from './Schedule'
|
|
19
20
|
import { SearchBar } from './SearchBar'
|
|
20
21
|
import { RangeCalendar } from './RangeCalendar'
|
|
@@ -52,6 +53,7 @@ export {
|
|
|
52
53
|
PaginationButton,
|
|
53
54
|
Personalization,
|
|
54
55
|
ProtectedRoute,
|
|
56
|
+
PushTokens,
|
|
55
57
|
Schedule,
|
|
56
58
|
SearchBar,
|
|
57
59
|
RangeCalendar,
|
|
@@ -66,7 +66,7 @@ export const ProductIngredient = (props) => {
|
|
|
66
66
|
<Button
|
|
67
67
|
borderRadius='8px'
|
|
68
68
|
color='lightPrimary'
|
|
69
|
-
onClick={() => handleOpenIngredient(null)}
|
|
69
|
+
onClick={() => handleOpenIngredient(null, true)}
|
|
70
70
|
>
|
|
71
71
|
{t('ADD_INGREDIENT', 'Add ingredient')}
|
|
72
72
|
</Button>
|
|
@@ -83,7 +83,7 @@ export const ProductIngredient = (props) => {
|
|
|
83
83
|
))}
|
|
84
84
|
<AddIngredientButtonWrapper>
|
|
85
85
|
<LinkButton
|
|
86
|
-
onClick={() => handleOpenIngredient(null)}
|
|
86
|
+
onClick={() => handleOpenIngredient(null, true)}
|
|
87
87
|
>
|
|
88
88
|
{t('ADD_INGREDIENT', 'Add ingredient')}
|
|
89
89
|
</LinkButton>
|
|
@@ -10,7 +10,7 @@ import { BusinessManagerBusinesses } from '../BusinessManagerBusinesses'
|
|
|
10
10
|
import { ArrowsAngleContract, ArrowsAngleExpand, Envelope, Phone, ThreeDots } from 'react-bootstrap-icons'
|
|
11
11
|
import { Dropdown, DropdownButton } from 'react-bootstrap'
|
|
12
12
|
import { useTheme } from 'styled-components'
|
|
13
|
-
import { Confirm } from '../../Shared'
|
|
13
|
+
import { Confirm, PushTokens } from '../../Shared'
|
|
14
14
|
import { Personalization } from '../../Shared/Personalization'
|
|
15
15
|
import { UserMetaFields } from '../UserMetaFields'
|
|
16
16
|
import { IconButton, Switch } from '../../../styles'
|
|
@@ -208,6 +208,12 @@ export const UserDetailsUI = (props) => {
|
|
|
208
208
|
<Personalization />
|
|
209
209
|
</PersonalizationWrapper>
|
|
210
210
|
)}
|
|
211
|
+
{currentMenuSelected === 'push_tokens' && (
|
|
212
|
+
<PushTokens
|
|
213
|
+
userId={userState.user?.id}
|
|
214
|
+
pushTokens={userState.user?.push_tokens || []}
|
|
215
|
+
/>
|
|
216
|
+
)}
|
|
211
217
|
</>
|
|
212
218
|
)}
|
|
213
219
|
<Confirm
|
|
@@ -31,7 +31,8 @@ export const UserDetailsMenu = (props) => {
|
|
|
31
31
|
{ key: 'saved_places', content: t('SAVED_PLACES', 'Saved places') },
|
|
32
32
|
{ key: 'orders', content: t('ORDERS', 'Orders') },
|
|
33
33
|
{ key: 'metafields', content: t('METAFIELDS', 'Metafields') },
|
|
34
|
-
{ key: 'personalization', content: t('PERSONALIZATION', 'Personalization') }
|
|
34
|
+
{ key: 'personalization', content: t('PERSONALIZATION', 'Personalization') },
|
|
35
|
+
{ key: 'push_tokens', content: t('PUSH_TOKENS', 'Push tokens') }
|
|
35
36
|
]
|
|
36
37
|
|
|
37
38
|
const professionalMenuList = [
|
|
Binary file
|
|
@@ -15,7 +15,7 @@ export const CustomersList = (props) => {
|
|
|
15
15
|
'country_phone_code', 'city_id', 'city', 'address', 'addresses',
|
|
16
16
|
'address_notes', 'dropdown_option_id', 'dropdown_option', 'location',
|
|
17
17
|
'zipcode', 'level', 'enabled', 'middle_name', 'second_lastname', 'birthdate', 'drivergroups',
|
|
18
|
-
'phone_verified', 'email_verified', 'wallets', 'orders_count'
|
|
18
|
+
'phone_verified', 'email_verified', 'wallets', 'orders_count', 'push_tokens'
|
|
19
19
|
],
|
|
20
20
|
onUserRedirect: (userId) => {
|
|
21
21
|
if (!userId) {
|
|
@@ -15,7 +15,7 @@ export const ManagersList = (props) => {
|
|
|
15
15
|
'country_phone_code', 'city_id', 'city', 'address', 'addresses',
|
|
16
16
|
'address_notes', 'dropdown_option_id', 'dropdown_option', 'location',
|
|
17
17
|
'zipcode', 'level', 'enabled', 'middle_name', 'second_lastname', 'birthdate', 'drivergroups',
|
|
18
|
-
'phone_verified', 'email_verified', 'wallets'
|
|
18
|
+
'phone_verified', 'email_verified', 'wallets', 'push_tokens'
|
|
19
19
|
],
|
|
20
20
|
onUserRedirect: (userId) => {
|
|
21
21
|
if (!userId) {
|