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
|
@@ -93,10 +93,14 @@ export const WrapperStar = styled.div`
|
|
|
93
93
|
`
|
|
94
94
|
|
|
95
95
|
export const DriverInfo = styled.div`
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
width: 100%;
|
|
97
|
+
flex: 1;
|
|
98
|
+
${({ hidePhoto }) => !hidePhoto && css`
|
|
99
|
+
${props => props.theme?.rtl ? css`
|
|
100
|
+
margin-right: 15px;
|
|
101
|
+
` : css`
|
|
102
|
+
margin-left: 15px;
|
|
103
|
+
`}
|
|
100
104
|
`}
|
|
101
105
|
> div:first-child {
|
|
102
106
|
display: flex;
|
|
@@ -106,7 +110,7 @@ export const DriverInfo = styled.div`
|
|
|
106
110
|
margin: 0 5px;
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
p {
|
|
113
|
+
p.name {
|
|
110
114
|
font-size: 14px;
|
|
111
115
|
color: ${props => props.theme.colors?.headingColor};
|
|
112
116
|
font-weight: 600;
|
|
@@ -114,8 +118,13 @@ export const DriverInfo = styled.div`
|
|
|
114
118
|
flex: 1;
|
|
115
119
|
}
|
|
116
120
|
.text-red {
|
|
117
|
-
|
|
121
|
+
font-size: 14px;
|
|
118
122
|
color: red;
|
|
123
|
+
${props => props.theme?.rtl ? css`
|
|
124
|
+
margin-right: 2px;
|
|
125
|
+
` : css`
|
|
126
|
+
margin-left: 2px;
|
|
127
|
+
`}
|
|
119
128
|
}
|
|
120
129
|
}
|
|
121
130
|
`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { useLanguage, useConfig } from 'ordering-components-admin-external'
|
|
3
|
-
import { useForm } from 'react-hook-form'
|
|
3
|
+
import { useForm, Controller } from 'react-hook-form'
|
|
4
4
|
import { Button, Input, TextArea } from '../../../styles'
|
|
5
5
|
import { Alert, Modal } from '../../Shared'
|
|
6
6
|
import { RecordCircleFill, Circle } from 'react-bootstrap-icons'
|
|
@@ -21,7 +21,8 @@ export const RefundToWallet = (props) => {
|
|
|
21
21
|
const {
|
|
22
22
|
order,
|
|
23
23
|
actionStatus,
|
|
24
|
-
handleOrderRefund
|
|
24
|
+
handleOrderRefund,
|
|
25
|
+
stripePaymethods
|
|
25
26
|
} = props
|
|
26
27
|
|
|
27
28
|
const [, t] = useLanguage()
|
|
@@ -31,7 +32,7 @@ export const RefundToWallet = (props) => {
|
|
|
31
32
|
const isAllowStripeRefund = configs?.refund_stripe_allow_when_order_cancelled?.value === '1'
|
|
32
33
|
const isAllowOtherRefund = configs?.refund_other_allow_when_order_cancelled?.value === '1'
|
|
33
34
|
|
|
34
|
-
const { handleSubmit, register, errors } = useForm()
|
|
35
|
+
const { handleSubmit, register, errors, control } = useForm()
|
|
35
36
|
const [openModal, setOpenModal] = useState(false)
|
|
36
37
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
37
38
|
const [isRefundAll, setIsRefundAll] = useState(true)
|
|
@@ -73,6 +74,9 @@ export const RefundToWallet = (props) => {
|
|
|
73
74
|
setRefundAllDisabled(false)
|
|
74
75
|
setIsRefundAll(true)
|
|
75
76
|
|
|
77
|
+
if (order?.refund_data && stripePaymethods.includes(order?.paymethod?.gateway)) {
|
|
78
|
+
setRefundDisabled(true)
|
|
79
|
+
}
|
|
76
80
|
if (!order?.payment_events) return
|
|
77
81
|
const totalRefundAmount = order?.payment_events?.filter(item => item.event === 'refund').reduce((total, event) => total + (event?.amount || 0), 0) || 0
|
|
78
82
|
if (totalRefundAmount === (order?.summary?.total || order?.total)) {
|
|
@@ -88,7 +92,7 @@ export const RefundToWallet = (props) => {
|
|
|
88
92
|
if (event?.wallet_event?.wallet?.type === 'cash') {
|
|
89
93
|
if (isAllowCashWalletRefund) {
|
|
90
94
|
_refundOptions.push({
|
|
91
|
-
value:
|
|
95
|
+
value: 'cash_wallet',
|
|
92
96
|
content: <Option>{t('CASH_WALLET', 'Cash Wallet')}</Option>
|
|
93
97
|
})
|
|
94
98
|
}
|
|
@@ -108,10 +112,12 @@ export const RefundToWallet = (props) => {
|
|
|
108
112
|
}
|
|
109
113
|
} else {
|
|
110
114
|
if (isAllowOtherRefund) {
|
|
111
|
-
_refundOptions.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
if (!_refundOptions.find(item => item.value === 'cash_wallet')) {
|
|
116
|
+
_refundOptions.push({
|
|
117
|
+
value: 'cash_wallet',
|
|
118
|
+
content: <Option>{t('CASH_WALLET', 'Cash Wallet')}</Option>
|
|
119
|
+
})
|
|
120
|
+
}
|
|
115
121
|
}
|
|
116
122
|
}
|
|
117
123
|
})
|
|
@@ -189,9 +195,18 @@ export const RefundToWallet = (props) => {
|
|
|
189
195
|
)}
|
|
190
196
|
<RefundReasonContainer>
|
|
191
197
|
<label>{t('COMMENTS', 'Comments')}</label>
|
|
192
|
-
<
|
|
193
|
-
rows={3}
|
|
198
|
+
<Controller
|
|
194
199
|
name='description'
|
|
200
|
+
control={control}
|
|
201
|
+
render={({ onChange, value }) => (
|
|
202
|
+
<TextArea
|
|
203
|
+
rows={3}
|
|
204
|
+
value={value}
|
|
205
|
+
onChange={e => {
|
|
206
|
+
onChange(e.target.value)
|
|
207
|
+
}}
|
|
208
|
+
/>
|
|
209
|
+
)}
|
|
195
210
|
/>
|
|
196
211
|
</RefundReasonContainer>
|
|
197
212
|
<Button
|
|
@@ -268,6 +268,7 @@ export const OrderBill = (props) => {
|
|
|
268
268
|
order={order}
|
|
269
269
|
actionStatus={actionStatus}
|
|
270
270
|
handleOrderRefund={handleOrderRefund}
|
|
271
|
+
stripePaymethods={stripePaymethods}
|
|
271
272
|
/>
|
|
272
273
|
)}
|
|
273
274
|
{order?.payment_events?.filter(item => item.event === 'refund').length > 0 && (
|
|
@@ -360,7 +361,7 @@ export const OrderBill = (props) => {
|
|
|
360
361
|
<Button
|
|
361
362
|
color='primary'
|
|
362
363
|
borderRadius='8px'
|
|
363
|
-
disabled={actionStatus?.loading}
|
|
364
|
+
disabled={actionStatus?.loading || order?.payment_events?.find(item => item.event === 'refund' && stripePaymethods.includes(item?.paymethod?.gateway))}
|
|
364
365
|
onClick={onClickRefund}
|
|
365
366
|
>
|
|
366
367
|
{t('REFUND', 'Refund')}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useContext, useState } from 'react'
|
|
2
|
-
import { useLanguage, useSession, useUtils } from 'ordering-components-admin-external'
|
|
2
|
+
import { useLanguage, useSession, useUtils, useConfig, GoogleAutocompleteInput } from 'ordering-components-admin-external'
|
|
3
3
|
import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
|
|
4
4
|
import BisBusiness from '@meronex/icons/bi/BisBusiness'
|
|
5
5
|
import { DriverSelector } from '../DriverSelector'
|
|
6
6
|
import { CompanySelector } from '../CompanySelector'
|
|
7
|
-
import { IconButton } from '../../../styles'
|
|
8
|
-
import { Telephone, ChevronDown } from 'react-bootstrap-icons'
|
|
7
|
+
import { Button, IconButton, Input, TextArea } from '../../../styles'
|
|
8
|
+
import { Telephone, ChevronDown, Pencil } from 'react-bootstrap-icons'
|
|
9
9
|
import { Accordion, AccordionContext, useAccordionToggle } from 'react-bootstrap'
|
|
10
10
|
import { ReviewCustomer } from '../ReviewCustomer'
|
|
11
11
|
import { Modal } from '../../Shared'
|
|
@@ -23,24 +23,38 @@ import {
|
|
|
23
23
|
CutsomerDetail,
|
|
24
24
|
CustomerInfoTable,
|
|
25
25
|
ToggleItemWrapper,
|
|
26
|
-
ReviewButton
|
|
26
|
+
ReviewButton,
|
|
27
|
+
CustomerEditWrapper,
|
|
28
|
+
ActionIconWrapper,
|
|
29
|
+
ReviewWrapper
|
|
27
30
|
} from './styles'
|
|
28
31
|
|
|
29
32
|
export const OrderContactInformation = (props) => {
|
|
30
33
|
const {
|
|
31
34
|
order,
|
|
35
|
+
customerInfoState,
|
|
36
|
+
handleChangeCustomerInfoState,
|
|
32
37
|
isTourOpen,
|
|
33
38
|
setCurrentTourStep,
|
|
34
39
|
handleOpenMessages,
|
|
35
|
-
isServiceOrder
|
|
40
|
+
isServiceOrder,
|
|
41
|
+
handleUpdateCustomerInfo,
|
|
42
|
+
setIsCommentPopup,
|
|
43
|
+
setAddressState
|
|
36
44
|
} = props
|
|
37
45
|
|
|
38
46
|
const [, t] = useLanguage()
|
|
39
47
|
const [{ user }] = useSession()
|
|
40
48
|
const [{ optimizeImage }] = useUtils()
|
|
49
|
+
const [{ configs }] = useConfig()
|
|
50
|
+
|
|
51
|
+
const googleMapsApiKey = configs?.google_maps_api_key?.value
|
|
41
52
|
|
|
42
53
|
const [isModalOpen, setIsModalOpen] = useState(false)
|
|
43
54
|
const [currentCustomer, setCurrentCustomer] = useState(null)
|
|
55
|
+
const [isEdit, setIsEdit] = useState(false)
|
|
56
|
+
|
|
57
|
+
console.log(customerInfoState, 'customerInfoState')
|
|
44
58
|
|
|
45
59
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
|
|
46
60
|
|
|
@@ -53,6 +67,28 @@ export const OrderContactInformation = (props) => {
|
|
|
53
67
|
setIsModalOpen(false)
|
|
54
68
|
}
|
|
55
69
|
|
|
70
|
+
const handleEdit = (event) => {
|
|
71
|
+
if (event.target.closest('#accordion1').getAttribute('data-id') === '1') {
|
|
72
|
+
event.stopPropagation()
|
|
73
|
+
setIsEdit(prev => !prev)
|
|
74
|
+
} else {
|
|
75
|
+
setIsEdit(true)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const handleChangeAddress = (e) => {
|
|
80
|
+
setAddressState({
|
|
81
|
+
address: e?.address,
|
|
82
|
+
location: e?.location,
|
|
83
|
+
zipcode: e?.zipcode
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const handleUpdateCustomer = async () => {
|
|
88
|
+
await handleUpdateCustomerInfo()
|
|
89
|
+
setIsEdit(false)
|
|
90
|
+
}
|
|
91
|
+
|
|
56
92
|
return (
|
|
57
93
|
<>
|
|
58
94
|
<Accordion>
|
|
@@ -153,73 +189,121 @@ export const OrderContactInformation = (props) => {
|
|
|
153
189
|
</ReviewButton>
|
|
154
190
|
)}
|
|
155
191
|
</InfoContent>
|
|
156
|
-
<
|
|
192
|
+
<ActionIconWrapper>
|
|
193
|
+
<Pencil className='edit-icon' onClick={handleEdit} />
|
|
194
|
+
<ChevronDown className='down-arrow' />
|
|
195
|
+
</ActionIconWrapper>
|
|
157
196
|
</CustomerInfo>
|
|
158
197
|
</ContextAwareToggle>
|
|
159
198
|
<Accordion.Collapse eventKey='1'>
|
|
160
199
|
<CutsomerDetail>
|
|
161
|
-
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
</
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
<
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
200
|
+
{isEdit ? (
|
|
201
|
+
<CustomerEditWrapper>
|
|
202
|
+
<Input
|
|
203
|
+
placeholder='(603) 555-0123'
|
|
204
|
+
value={customerInfoState?.customer?.cellphone ?? order?.customer?.cellphone ?? ''}
|
|
205
|
+
onChange={(e) => {
|
|
206
|
+
handleChangeCustomerInfoState({ cellphone: e.target.value })
|
|
207
|
+
}}
|
|
208
|
+
onKeyPress={(e) => {
|
|
209
|
+
if (!/^[0-9]$/.test(e.key)) {
|
|
210
|
+
e.preventDefault()
|
|
211
|
+
}
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
<Input
|
|
215
|
+
placeholder='jane.cooper@example.com'
|
|
216
|
+
value={customerInfoState?.customer?.email ?? order?.customer?.email ?? ''}
|
|
217
|
+
onChange={(e) => {
|
|
218
|
+
handleChangeCustomerInfoState({ email: e.target.value })
|
|
219
|
+
}}
|
|
220
|
+
/>
|
|
221
|
+
<GoogleAutocompleteInput
|
|
222
|
+
name='address'
|
|
223
|
+
className='input-autocomplete'
|
|
224
|
+
apiKey={googleMapsApiKey}
|
|
225
|
+
placeholder={t('ADDRESS', 'Address')}
|
|
226
|
+
onChangeAddress={(e) => {
|
|
227
|
+
handleChangeAddress(e)
|
|
228
|
+
}}
|
|
229
|
+
defaultValue={order?.customer?.address ?? ''}
|
|
230
|
+
autoComplete='new-password'
|
|
231
|
+
countryCode={configs?.country_autocomplete?.value || '*'}
|
|
232
|
+
/>
|
|
233
|
+
{/* <ReviewWrapper>
|
|
234
|
+
<label>{t('REVIEW_FROM_DRIVER_OR_ADMIN', 'Review from driver or admin')}</label>
|
|
235
|
+
<TextArea
|
|
236
|
+
placeholder={t('REVIEW', 'Review')}
|
|
237
|
+
/>
|
|
238
|
+
</ReviewWrapper> */}
|
|
239
|
+
<Button color='primary' onClick={handleUpdateCustomer}>
|
|
240
|
+
{customerInfoState?.loading ? t('LOADING', 'Loading') : t('SAVE', 'Save')}
|
|
241
|
+
</Button>
|
|
242
|
+
</CustomerEditWrapper>
|
|
243
|
+
) : (
|
|
244
|
+
<CustomerInfoTable>
|
|
245
|
+
<tbody>
|
|
246
|
+
{order?.customer?.cellphone && (
|
|
247
|
+
<tr>
|
|
248
|
+
<td>{t('CELLPHONE', 'Phone / Mobile')}</td>
|
|
249
|
+
<td>
|
|
250
|
+
<a href={`tel:${order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''}${order?.customer?.cellphone}`}>
|
|
251
|
+
{(order?.customer?.country_phone_code && `+${order?.customer?.country_phone_code}`)} {order?.customer?.cellphone}
|
|
252
|
+
</a>
|
|
253
|
+
</td>
|
|
254
|
+
</tr>
|
|
255
|
+
)}
|
|
256
|
+
{order?.customer?.email && (
|
|
257
|
+
<tr>
|
|
258
|
+
<td>{t('EMAIL', 'Email')}</td>
|
|
259
|
+
<td>
|
|
260
|
+
<a href={`mailto: ${order?.customer?.email}`}>{order?.customer?.email}</a>
|
|
261
|
+
</td>
|
|
262
|
+
</tr>
|
|
263
|
+
)}
|
|
264
|
+
{!!order?.customer?.address && (
|
|
265
|
+
<tr>
|
|
266
|
+
<td>{t('CHECKOUT_FULL_ADDRESS', 'Full address')}</td>
|
|
267
|
+
<td>
|
|
268
|
+
<a href={`http://maps.google.com/?q=${order?.customer?.address}`} rel='noopener noreferrer' target='_blank'>{order?.customer?.address}</a>
|
|
269
|
+
</td>
|
|
270
|
+
</tr>
|
|
271
|
+
)}
|
|
272
|
+
{!!order?.customer?.location && (
|
|
273
|
+
<tr>
|
|
274
|
+
<td>{t('LOCATION', 'Location')}</td>
|
|
275
|
+
<td>
|
|
276
|
+
<a href={`http://maps.google.com/?q=${order?.customer?.location?.lat},${order?.customer?.location?.lng}`} rel='noopener noreferrer' target='_blank'>{order?.customer?.location?.lat}, {order?.customer?.location?.lng}</a>
|
|
277
|
+
</td>
|
|
278
|
+
</tr>
|
|
279
|
+
)}
|
|
280
|
+
{!!order?.customer?.internal_number && (
|
|
281
|
+
<tr>
|
|
282
|
+
<td>{t('INTERNAL_NUMBER', 'Internal number')}</td>
|
|
283
|
+
<td>{order?.customer?.internal_number}</td>
|
|
284
|
+
</tr>
|
|
285
|
+
)}
|
|
286
|
+
{!!order?.customer?.address_notes && (
|
|
287
|
+
<tr>
|
|
288
|
+
<td>{t('NOTES', 'Notes')}</td>
|
|
289
|
+
<td>{order?.customer?.address_notes}</td>
|
|
290
|
+
</tr>
|
|
291
|
+
)}
|
|
292
|
+
{!!order?.customer?.zipcode && (
|
|
293
|
+
<tr>
|
|
294
|
+
<td>{t('ZIPCODE', 'Zipcode')}</td>
|
|
295
|
+
<td>{order?.customer?.zipcode}</td>
|
|
296
|
+
</tr>
|
|
297
|
+
)}
|
|
298
|
+
{!!order?.on_behalf_of && (
|
|
299
|
+
<tr>
|
|
300
|
+
<td>{t('ON_BEHALF_OF', 'On behalf of')}</td>
|
|
301
|
+
<td>{order?.on_behalf_of}</td>
|
|
302
|
+
</tr>
|
|
303
|
+
)}
|
|
304
|
+
</tbody>
|
|
305
|
+
</CustomerInfoTable>
|
|
306
|
+
)}
|
|
223
307
|
</CutsomerDetail>
|
|
224
308
|
</Accordion.Collapse>
|
|
225
309
|
</Accordion>
|
|
@@ -254,6 +338,7 @@ export const OrderContactInformation = (props) => {
|
|
|
254
338
|
handleOpenMessages={handleOpenMessages}
|
|
255
339
|
isOrderDrivers
|
|
256
340
|
orderId={order?.id}
|
|
341
|
+
setIsCommentPopup={setIsCommentPopup}
|
|
257
342
|
/>
|
|
258
343
|
</DriverSelectorContainer>
|
|
259
344
|
)}
|
|
@@ -322,6 +407,8 @@ const ContextAwareToggle = ({ children, eventKey, callback }) => {
|
|
|
322
407
|
<ToggleItemWrapper
|
|
323
408
|
active={isCurrentEventKey}
|
|
324
409
|
onClick={handleButtonClick}
|
|
410
|
+
id={`accordion${eventKey}`}
|
|
411
|
+
data-id={isCurrentEventKey ? '1' : '0'}
|
|
325
412
|
>
|
|
326
413
|
{children}
|
|
327
414
|
</ToggleItemWrapper>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import styled, { css } from 'styled-components'
|
|
3
|
+
import { darken } from 'polished'
|
|
3
4
|
|
|
4
5
|
export const BusinessInfo = styled.div`
|
|
5
6
|
display: flex;
|
|
@@ -101,6 +102,35 @@ export const InfoContent = styled.div`
|
|
|
101
102
|
|
|
102
103
|
export const CustomerInfo = styled(BusinessInfo)``
|
|
103
104
|
|
|
105
|
+
export const ActionIconWrapper = styled.div`
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
height: 100%;
|
|
109
|
+
position: absolute;
|
|
110
|
+
right: 0;
|
|
111
|
+
top: 0;
|
|
112
|
+
> .down-arrow {
|
|
113
|
+
transition: all 0.3s;
|
|
114
|
+
margin: 0 10px;
|
|
115
|
+
}
|
|
116
|
+
.edit-icon {
|
|
117
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
}
|
|
120
|
+
`
|
|
121
|
+
|
|
122
|
+
export const ReviewWrapper = styled.div`
|
|
123
|
+
margin-top: 23px;
|
|
124
|
+
label {
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
font-weight: 500;
|
|
127
|
+
margin-bottom: 12px;
|
|
128
|
+
}
|
|
129
|
+
textarea {
|
|
130
|
+
width: 100%;
|
|
131
|
+
}
|
|
132
|
+
`
|
|
133
|
+
|
|
104
134
|
export const DriverInfoContainer = styled.div`
|
|
105
135
|
display: flex;
|
|
106
136
|
align-items: center;
|
|
@@ -209,3 +239,40 @@ export const ReviewButton = styled.span`
|
|
|
209
239
|
font-size: 14px;
|
|
210
240
|
text-decoration: underline;
|
|
211
241
|
`
|
|
242
|
+
|
|
243
|
+
export const CustomerEditWrapper = styled.div`
|
|
244
|
+
input {
|
|
245
|
+
width: 100%;
|
|
246
|
+
margin-bottom: 12px;
|
|
247
|
+
}
|
|
248
|
+
.input-autocomplete {
|
|
249
|
+
width: 100%;
|
|
250
|
+
background: ${props => props.theme.colors?.backgroundPage || '#FFF'};
|
|
251
|
+
border: 1px solid ${props => props.theme.colors.borderColor};
|
|
252
|
+
border-radius: 8px;
|
|
253
|
+
font-size: 14px;
|
|
254
|
+
padding: 10px 15px;
|
|
255
|
+
outline: none;
|
|
256
|
+
::placeholder {
|
|
257
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&:-ms-input-placeholder {
|
|
261
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&::-ms-input-placeholder { /* Microsoft Edge */
|
|
265
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
266
|
+
}
|
|
267
|
+
&:focus {
|
|
268
|
+
border-color: ${() => darken(0.07, '#CCC')};
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
button {
|
|
272
|
+
margin-top: 10px;
|
|
273
|
+
display: block;
|
|
274
|
+
height: 44px;
|
|
275
|
+
border-radius: 8px;
|
|
276
|
+
margin-left: auto;
|
|
277
|
+
}
|
|
278
|
+
`
|
|
@@ -12,10 +12,11 @@ import { OrderBill } from '../OrderBill'
|
|
|
12
12
|
import { OrderContactInformation } from '../OrderContactInformation'
|
|
13
13
|
import { XLg } from 'react-bootstrap-icons'
|
|
14
14
|
import { NotFoundSource, Modal, Alert } from '../../Shared'
|
|
15
|
-
import { IconButton } from '../../../styles'
|
|
15
|
+
import { Button, IconButton, TextArea } from '../../../styles'
|
|
16
16
|
import { OrderToPrint } from '../OrderToPrint'
|
|
17
17
|
import { OrderToPrintTicket } from '../OrderToPrintTicket'
|
|
18
18
|
import { getOrderStatuPickUp, getOrderStatus, getCurrenySymbol } from '../../../utils'
|
|
19
|
+
import { useForm } from 'react-hook-form'
|
|
19
20
|
|
|
20
21
|
import {
|
|
21
22
|
Container,
|
|
@@ -34,15 +35,22 @@ import {
|
|
|
34
35
|
RejectReasonsContainer,
|
|
35
36
|
RejectReasonWrapper,
|
|
36
37
|
RejectReasonsList,
|
|
37
|
-
DetailBottom
|
|
38
|
+
DetailBottom,
|
|
39
|
+
FormControl,
|
|
40
|
+
AssigmentCommentContainer,
|
|
41
|
+
ErrorMessage
|
|
38
42
|
} from './styles'
|
|
39
43
|
|
|
40
44
|
const OrderDetailsUI = (props) => {
|
|
41
45
|
const {
|
|
42
46
|
isSelectedOrders,
|
|
47
|
+
handleChangeCustomerInfoState,
|
|
48
|
+
customerInfoState,
|
|
49
|
+
handleUpdateCustomerInfo,
|
|
43
50
|
open,
|
|
44
51
|
handleBackRedirect,
|
|
45
52
|
handleUpdateOrderStatus,
|
|
53
|
+
setAddressState,
|
|
46
54
|
isTourOpen,
|
|
47
55
|
handleUpdateOrderForUnreadCount,
|
|
48
56
|
messages,
|
|
@@ -54,9 +62,15 @@ const OrderDetailsUI = (props) => {
|
|
|
54
62
|
actionStatus,
|
|
55
63
|
handleRefundPaymentsStripe,
|
|
56
64
|
handleOrderRefund,
|
|
57
|
-
isServiceOrder
|
|
65
|
+
isServiceOrder,
|
|
66
|
+
handleUpdateComment
|
|
58
67
|
} = props
|
|
59
68
|
|
|
69
|
+
const {
|
|
70
|
+
register,
|
|
71
|
+
handleSubmit,
|
|
72
|
+
formState: { errors }
|
|
73
|
+
} = useForm()
|
|
60
74
|
const history = useHistory()
|
|
61
75
|
const query = new URLSearchParams(useLocation().search)
|
|
62
76
|
const [, t] = useLanguage()
|
|
@@ -73,6 +87,7 @@ const OrderDetailsUI = (props) => {
|
|
|
73
87
|
const [extraOpen, setExtraOpen] = useState(false)
|
|
74
88
|
const [isExpand, setIsExpand] = useState(false)
|
|
75
89
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
90
|
+
const [isCommentPopup, setIsCommentPopup] = useState(false)
|
|
76
91
|
|
|
77
92
|
const placeSpotEnabled = [3, 4]
|
|
78
93
|
const {
|
|
@@ -256,6 +271,11 @@ const OrderDetailsUI = (props) => {
|
|
|
256
271
|
history.replace(`${location.pathname}?id=${orderId}`)
|
|
257
272
|
}
|
|
258
273
|
|
|
274
|
+
const onSubmit = (data) => {
|
|
275
|
+
handleUpdateComment(data?.manual_driver_assignment_comment)
|
|
276
|
+
setIsCommentPopup(false)
|
|
277
|
+
}
|
|
278
|
+
|
|
259
279
|
useEffect(() => {
|
|
260
280
|
if (!open) return
|
|
261
281
|
document.addEventListener('keydown', onCloseSidebar)
|
|
@@ -322,13 +342,12 @@ const OrderDetailsUI = (props) => {
|
|
|
322
342
|
<OrderStatus isDisabled={isTourOpen && currentTourStep === 1}>
|
|
323
343
|
<div>
|
|
324
344
|
<h2>{t('ORDER_STATUS_TEXT', 'Order status')}</h2>
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
</p>
|
|
345
|
+
{order?.delivery_datetime_utc &&
|
|
346
|
+
<p>{parseDate(order?.delivery_datetime_utc)}</p>
|
|
347
|
+
}
|
|
348
|
+
{order?.delivery_datetime && (
|
|
349
|
+
<p>{parseDate(order?.delivery_datetime, { utc: false })} {`(${t('BUSINESS_TIME', 'Business time')})`}</p>
|
|
350
|
+
)}
|
|
332
351
|
<p>{order?.eta_time} {t('MIN', 'min')}</p>
|
|
333
352
|
</div>
|
|
334
353
|
<OrderStatusSelectorWrapper>
|
|
@@ -379,12 +398,17 @@ const OrderDetailsUI = (props) => {
|
|
|
379
398
|
<div data-tour='tour_driver'>
|
|
380
399
|
<OrderContactInformation
|
|
381
400
|
isServiceOrder={isServiceOrder}
|
|
401
|
+
customerInfoState={customerInfoState}
|
|
402
|
+
handleChangeCustomerInfoState={handleChangeCustomerInfoState}
|
|
403
|
+
handleUpdateCustomerInfo={handleUpdateCustomerInfo}
|
|
382
404
|
order={order}
|
|
383
405
|
extraOpen={extraOpen}
|
|
384
406
|
unreadAlert={unreadAlert}
|
|
385
407
|
isTourOpen={isTourOpen}
|
|
386
408
|
setCurrentTourStep={setCurrentTourStep}
|
|
409
|
+
setAddressState={setAddressState}
|
|
387
410
|
handleShowOption={handleShowOption}
|
|
411
|
+
setIsCommentPopup={setIsCommentPopup}
|
|
388
412
|
/>
|
|
389
413
|
<OrderProducts>
|
|
390
414
|
<h2>{t('EXPORT_SUMMARY', 'Summary')}</h2>
|
|
@@ -544,6 +568,27 @@ const OrderDetailsUI = (props) => {
|
|
|
544
568
|
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
545
569
|
closeOnBackdrop={false}
|
|
546
570
|
/>
|
|
571
|
+
<Modal
|
|
572
|
+
width='500px'
|
|
573
|
+
open={isCommentPopup}
|
|
574
|
+
title={t('ORDERING', 'Ordering')}
|
|
575
|
+
onClose={() => setIsCommentPopup(false)}
|
|
576
|
+
>
|
|
577
|
+
<AssigmentCommentContainer onSubmit={handleSubmit(onSubmit)}>
|
|
578
|
+
<FormControl isError={errors.manual_driver_assignment_comment}>
|
|
579
|
+
<label>{t('MANUAL_DRIVER_ASSIGMENT_COMMENT', 'Manual driver assigment comment')}</label>
|
|
580
|
+
<TextArea
|
|
581
|
+
name='manual_driver_assignment_comment'
|
|
582
|
+
placeholder={t('MANUAL_DRIVER_ASSIGMENT_COMMENT', 'Manual driver assigment comment')}
|
|
583
|
+
ref={register({
|
|
584
|
+
required: true
|
|
585
|
+
})}
|
|
586
|
+
/>
|
|
587
|
+
{errors.manual_driver_assignment_comment && <ErrorMessage>{t('FIELD_REQUIRED', 'This field is required')}</ErrorMessage>}
|
|
588
|
+
</FormControl>
|
|
589
|
+
<Button color='primary' type='submit'>{t('ACCEPT', 'Accept')}</Button>
|
|
590
|
+
</AssigmentCommentContainer>
|
|
591
|
+
</Modal>
|
|
547
592
|
</Container>
|
|
548
593
|
)
|
|
549
594
|
}
|