ordering-ui-react-native 0.12.14 → 0.12.18
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/package.json +1 -1
- package/src/components/AddressList/index.tsx +3 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
- package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
- package/themes/business/src/components/OrdersOption/index.tsx +19 -15
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +389 -0
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +36 -0
- package/themes/business/src/components 2/BusinessController/index.tsx +155 -0
- package/themes/business/src/components 2/BusinessController/styles.tsx +19 -0
- package/themes/business/src/components 2/Chat/index.tsx +1152 -0
- package/themes/business/src/components 2/Chat/styles.tsx +12 -0
- package/themes/business/src/components 2/Contacts/index.tsx +299 -0
- package/themes/business/src/components 2/Contacts/styles.tsx +42 -0
- package/themes/business/src/components 2/DriverMap/index.tsx +525 -0
- package/themes/business/src/components 2/FloatingButton/index.tsx +141 -0
- package/themes/business/src/components 2/FloatingButton/styles.tsx +35 -0
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +204 -0
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +11 -0
- package/themes/business/src/components 2/GoogleMap/index.tsx +347 -0
- package/themes/business/src/components 2/Home/index.tsx +111 -0
- package/themes/business/src/components 2/Home/styles.tsx +27 -0
- package/themes/business/src/components 2/LanguageSelector/index.tsx +124 -0
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +152 -0
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +17 -0
- package/themes/business/src/components 2/LoginForm/index.tsx +663 -0
- package/themes/business/src/components 2/LoginForm/styles.tsx +48 -0
- package/themes/business/src/components 2/LogoutButton/index.tsx +63 -0
- package/themes/business/src/components 2/MapView/index.tsx +317 -0
- package/themes/business/src/components 2/MessagesOption/index.tsx +337 -0
- package/themes/business/src/components 2/MessagesOption/styles.tsx +27 -0
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +167 -0
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +8 -0
- package/themes/business/src/components 2/NotFoundSource/index.tsx +52 -0
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +17 -0
- package/themes/business/src/components 2/OrderDetails/Business.tsx +683 -0
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +454 -0
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +391 -0
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +148 -0
- package/themes/business/src/components 2/OrderDetails/styles.tsx +84 -0
- package/themes/business/src/components 2/OrderMessage/index.tsx +344 -0
- package/themes/business/src/components 2/OrderMessage/styles.tsx +5 -0
- package/themes/business/src/components 2/OrderSummary/index.tsx +700 -0
- package/themes/business/src/components 2/OrderSummary/styles.tsx +61 -0
- package/themes/business/src/components 2/OrdersOption/index.tsx +755 -0
- package/themes/business/src/components 2/OrdersOption/styles.tsx +54 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +51 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +35 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +50 -0
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +49 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +46 -0
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +8 -0
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +160 -0
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +3 -0
- package/themes/business/src/components 2/PreviousMessages/index.tsx +304 -0
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +32 -0
- package/themes/business/src/components 2/PreviousOrders/index.tsx +180 -0
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +38 -0
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +301 -0
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +61 -0
- package/themes/business/src/components 2/SearchBar/index.tsx +112 -0
- package/themes/business/src/components 2/SignupForm/index.tsx +530 -0
- package/themes/business/src/components 2/SignupForm/styles.tsx +16 -0
- package/themes/business/src/components 2/StoresList/index.tsx +208 -0
- package/themes/business/src/components 2/StoresList/styles.tsx +26 -0
- package/themes/business/src/components 2/UserFormDetails/index.tsx +513 -0
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +40 -0
- package/themes/business/src/components 2/UserProfileForm/index.tsx +496 -0
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +36 -0
- package/themes/business/src/components 2/VerifyPhone/index.tsx +201 -0
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +43 -0
- package/themes/business/src/components 2/shared/OAlert.tsx +52 -0
- package/themes/business/src/components 2/shared/OButton.tsx +149 -0
- package/themes/business/src/components 2/shared/OChatBubble.tsx +100 -0
- package/themes/business/src/components 2/shared/ODropDown.tsx +195 -0
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +328 -0
- package/themes/business/src/components 2/shared/OFab.tsx +54 -0
- package/themes/business/src/components 2/shared/OIcon.tsx +67 -0
- package/themes/business/src/components 2/shared/OIconButton.tsx +127 -0
- package/themes/business/src/components 2/shared/OInput.tsx +144 -0
- package/themes/business/src/components 2/shared/OLink.tsx +76 -0
- package/themes/business/src/components 2/shared/OModal.tsx +275 -0
- package/themes/business/src/components 2/shared/OSegment.tsx +86 -0
- package/themes/business/src/components 2/shared/OText.tsx +55 -0
- package/themes/business/src/components 2/shared/OTextarea.tsx +46 -0
- package/themes/business/src/components 2/shared/OToast.tsx +92 -0
- package/themes/business/src/components 2/shared/index.tsx +27 -0
- package/themes/business/src/types/index.tsx +4 -1
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
- package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
- package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
- package/themes/kiosk/src/components/ProductForm/index.tsx +129 -127
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
- package/themes/original/src/components/OrderProgress/index.tsx +32 -18
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
//React & React Native
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { StyleSheet, View, Platform } from 'react-native';
|
|
4
|
+
|
|
5
|
+
// Thirds
|
|
6
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
7
|
+
|
|
8
|
+
//OrderingComponent
|
|
9
|
+
import {
|
|
10
|
+
useLanguage,
|
|
11
|
+
OrderDetails as OrderDetailsConTableoller,
|
|
12
|
+
useToast,
|
|
13
|
+
useSession,
|
|
14
|
+
ToastType,
|
|
15
|
+
} from 'ordering-components/native';
|
|
16
|
+
|
|
17
|
+
//Components
|
|
18
|
+
import Alert from '../../providers/AlertProvider';
|
|
19
|
+
import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
|
|
20
|
+
import { Chat } from '../Chat';
|
|
21
|
+
import { FloatingButton } from '../FloatingButton';
|
|
22
|
+
import { DriverMap } from '../DriverMap';
|
|
23
|
+
import { OButton } from '../shared';
|
|
24
|
+
import { OModal } from '../shared';
|
|
25
|
+
import { OrderDetailsParams } from '../../types';
|
|
26
|
+
import { USER_TYPE } from '../../config/constants';
|
|
27
|
+
import { useTheme } from 'styled-components/native';
|
|
28
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
29
|
+
import { getOrderStatus } from '../../utils';
|
|
30
|
+
import { OrderHeaderComponent } from './OrderHeaderComponent';
|
|
31
|
+
import { OrderContentComponent } from './OrderContentComponent';
|
|
32
|
+
|
|
33
|
+
//Styles
|
|
34
|
+
import { OrderDetailsContainer, Pickup } from './styles';
|
|
35
|
+
|
|
36
|
+
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
37
|
+
const {
|
|
38
|
+
navigation,
|
|
39
|
+
messages,
|
|
40
|
+
setMessages,
|
|
41
|
+
readMessages,
|
|
42
|
+
messagesReadList,
|
|
43
|
+
handleChangeOrderStatus,
|
|
44
|
+
permissions,
|
|
45
|
+
askLocationPermission,
|
|
46
|
+
driverLocation,
|
|
47
|
+
actions,
|
|
48
|
+
updateDriverPosition,
|
|
49
|
+
driverUpdateLocation,
|
|
50
|
+
setDriverUpdateLocation,
|
|
51
|
+
titleAccept,
|
|
52
|
+
titleReject,
|
|
53
|
+
appTitle,
|
|
54
|
+
} = props;
|
|
55
|
+
|
|
56
|
+
const [, { showToast }] = useToast();
|
|
57
|
+
const { order, loading, error } = props.order;
|
|
58
|
+
const theme = useTheme();
|
|
59
|
+
const [, t] = useLanguage();
|
|
60
|
+
const [session] = useSession();
|
|
61
|
+
const [actionOrder, setActionOrder] = useState('');
|
|
62
|
+
const [unreadAlert, setUnreadAlert] = useState({
|
|
63
|
+
business: false,
|
|
64
|
+
driver: false,
|
|
65
|
+
});
|
|
66
|
+
const [openModalForMapView, setOpenModalForMapView] = useState(false);
|
|
67
|
+
const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
|
|
68
|
+
const [openModalForAccept, setOpenModalForAccept] = useState(false);
|
|
69
|
+
const [alertState, setAlertState] = useState<{
|
|
70
|
+
open: boolean;
|
|
71
|
+
content: Array<string>;
|
|
72
|
+
key?: string | null;
|
|
73
|
+
}>({ open: false, content: [], key: null });
|
|
74
|
+
|
|
75
|
+
const showFloatButtonsPickUp: any = {
|
|
76
|
+
8: true,
|
|
77
|
+
3: true,
|
|
78
|
+
18: true,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const showFloatButtonsAcceptOrReject: any = {
|
|
82
|
+
0: true,
|
|
83
|
+
4: true,
|
|
84
|
+
7: true,
|
|
85
|
+
14: true
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const marginContainer: any = {
|
|
89
|
+
0: true,
|
|
90
|
+
3: true,
|
|
91
|
+
7: true,
|
|
92
|
+
8: true,
|
|
93
|
+
9: true,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const handleOpenMessagesForBusiness = () => {
|
|
97
|
+
setOpenModalForBusiness(true);
|
|
98
|
+
readMessages && readMessages();
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const handleOpenMapView = async () => {
|
|
102
|
+
if (permissions.locationStatus === 'granted') {
|
|
103
|
+
setOpenModalForMapView(!openModalForMapView);
|
|
104
|
+
} else if (permissions.locationStatus === 'blocked') {
|
|
105
|
+
// redirectToSettings();
|
|
106
|
+
showToast(
|
|
107
|
+
ToastType.Error,
|
|
108
|
+
t(
|
|
109
|
+
'GEOLOCATION_SERVICE_PERMISSION_BLOCKED',
|
|
110
|
+
'Geolocation service permissions blocked.',
|
|
111
|
+
),
|
|
112
|
+
);
|
|
113
|
+
} else {
|
|
114
|
+
const response = await askLocationPermission();
|
|
115
|
+
if (response === 'granted') {
|
|
116
|
+
setOpenModalForMapView(!openModalForMapView);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const handleViewActionOrder = (action: string) => {
|
|
122
|
+
if (openModalForMapView) {
|
|
123
|
+
setOpenModalForMapView(false);
|
|
124
|
+
}
|
|
125
|
+
setActionOrder(action);
|
|
126
|
+
setOpenModalForAccept(true);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (permissions.locationStatus !== 'granted' && openModalForMapView) {
|
|
131
|
+
setOpenModalForMapView(false);
|
|
132
|
+
}
|
|
133
|
+
}, [permissions.locationStatus]);
|
|
134
|
+
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (openModalForAccept) {
|
|
137
|
+
setOpenModalForAccept(false);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (openModalForBusiness) {
|
|
141
|
+
setOpenModalForBusiness(false);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (openModalForMapView) {
|
|
145
|
+
setOpenModalForMapView(false);
|
|
146
|
+
}
|
|
147
|
+
}, [loading]);
|
|
148
|
+
|
|
149
|
+
const handleCloseModal = () => {
|
|
150
|
+
setOpenModalForBusiness(false);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const handleArrowBack: any = () => {
|
|
154
|
+
navigation?.canGoBack() && navigation.goBack();
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
if (order?.driver === null && session?.user?.level === 4) {
|
|
159
|
+
setAlertState({
|
|
160
|
+
open: true,
|
|
161
|
+
content: [
|
|
162
|
+
t(
|
|
163
|
+
'YOU_HAVE_BEEN_REMOVED_FROM_THE_ORDER',
|
|
164
|
+
'You have been removed from the order',
|
|
165
|
+
),
|
|
166
|
+
],
|
|
167
|
+
key: null,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}, [order?.driver]);
|
|
171
|
+
|
|
172
|
+
const locations = [
|
|
173
|
+
{
|
|
174
|
+
...order?.business?.location,
|
|
175
|
+
title: order?.business?.name,
|
|
176
|
+
icon: order?.business?.logo || theme.images.dummies.businessLogo,
|
|
177
|
+
type: 'Business',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
...order?.customer?.location,
|
|
181
|
+
title: order?.customer?.name,
|
|
182
|
+
icon:
|
|
183
|
+
order?.customer?.photo ||
|
|
184
|
+
'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
|
|
185
|
+
type: 'Customer',
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if (driverLocation) {
|
|
191
|
+
locations[0] = driverLocation;
|
|
192
|
+
}
|
|
193
|
+
}, [driverLocation]);
|
|
194
|
+
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
if (messagesReadList?.length) {
|
|
197
|
+
openModalForBusiness
|
|
198
|
+
? setUnreadAlert({ ...unreadAlert, business: false })
|
|
199
|
+
: setUnreadAlert({ ...unreadAlert, driver: false });
|
|
200
|
+
}
|
|
201
|
+
}, [messagesReadList]);
|
|
202
|
+
|
|
203
|
+
const styles = StyleSheet.create({
|
|
204
|
+
btnPickUp: {
|
|
205
|
+
borderWidth: 0,
|
|
206
|
+
backgroundColor: theme.colors.btnBGWhite,
|
|
207
|
+
borderRadius: 8,
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
let locationMarker;
|
|
212
|
+
let isToFollow = false;
|
|
213
|
+
let isBusinessMarker = false;
|
|
214
|
+
|
|
215
|
+
if (order?.status === 7 || order?.status === 8) {
|
|
216
|
+
const markerBusiness = 'Business';
|
|
217
|
+
isBusinessMarker = true;
|
|
218
|
+
locationMarker = locations.find(
|
|
219
|
+
(location: any) => location.type === markerBusiness,
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
if (order?.status === 8) {
|
|
223
|
+
isToFollow = true;
|
|
224
|
+
}
|
|
225
|
+
} else if (order?.status === 3 || order?.status === 9) {
|
|
226
|
+
const markerCustomer = 'Customer';
|
|
227
|
+
isToFollow = true;
|
|
228
|
+
isBusinessMarker = false;
|
|
229
|
+
locationMarker = locations.find(
|
|
230
|
+
(location: any) => location.type === markerCustomer,
|
|
231
|
+
);
|
|
232
|
+
} else {
|
|
233
|
+
const markerBusiness = 'Business';
|
|
234
|
+
locationMarker = locations.find(
|
|
235
|
+
(location: any) => location.type === markerBusiness,
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return (
|
|
240
|
+
<>
|
|
241
|
+
{(!order || Object.keys(order).length === 0) &&
|
|
242
|
+
(error?.length < 1 || !error) && (
|
|
243
|
+
<View style={{ flex: 1 }}>
|
|
244
|
+
{[...Array(6)].map((item, i) => (
|
|
245
|
+
<Placeholder key={i} Animation={Fade}>
|
|
246
|
+
<View style={{ flexDirection: 'row', paddingVertical: 20 }}>
|
|
247
|
+
<Placeholder>
|
|
248
|
+
<PlaceholderLine width={100} />
|
|
249
|
+
<PlaceholderLine width={70} />
|
|
250
|
+
<PlaceholderLine width={30} />
|
|
251
|
+
<PlaceholderLine width={20} />
|
|
252
|
+
</Placeholder>
|
|
253
|
+
</View>
|
|
254
|
+
</Placeholder>
|
|
255
|
+
))}
|
|
256
|
+
</View>
|
|
257
|
+
)}
|
|
258
|
+
|
|
259
|
+
{(!!error || error) && (
|
|
260
|
+
<NotFoundSource
|
|
261
|
+
btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
|
|
262
|
+
content={
|
|
263
|
+
props.order.error[0] ||
|
|
264
|
+
props.order.error ||
|
|
265
|
+
t('NETWORK_ERROR', 'Network Error')
|
|
266
|
+
}
|
|
267
|
+
onClickButton={() => navigation.navigate('Orders')}
|
|
268
|
+
/>
|
|
269
|
+
)}
|
|
270
|
+
{order && Object.keys(order).length > 0 && (error?.length < 1 || !error) && (
|
|
271
|
+
<View style={{ flex: 1 }}>
|
|
272
|
+
<OrderHeaderComponent
|
|
273
|
+
order={order}
|
|
274
|
+
handleOpenMapView={handleOpenMapView}
|
|
275
|
+
handleOpenMessagesForBusiness={handleOpenMessagesForBusiness}
|
|
276
|
+
getOrderStatus={getOrderStatus}
|
|
277
|
+
handleArrowBack={handleArrowBack}
|
|
278
|
+
/>
|
|
279
|
+
<OrderDetailsContainer
|
|
280
|
+
keyboardShouldPersistTaps="handled"
|
|
281
|
+
showsVerticalScrollIndicator={false}
|
|
282
|
+
>
|
|
283
|
+
<>
|
|
284
|
+
<OrderContentComponent order={order} />
|
|
285
|
+
{(order?.status === 8 || order?.status === 18) && order?.delivery_type === 1 && (
|
|
286
|
+
<Pickup>
|
|
287
|
+
<OButton
|
|
288
|
+
style={styles.btnPickUp}
|
|
289
|
+
textStyle={{ color: theme.colors.primary }}
|
|
290
|
+
text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
|
|
291
|
+
onClick={() =>
|
|
292
|
+
handleChangeOrderStatus && handleChangeOrderStatus(3)
|
|
293
|
+
}
|
|
294
|
+
imgLeftStyle={{ tintColor: theme.colors.backArrow }}
|
|
295
|
+
/>
|
|
296
|
+
</Pickup>
|
|
297
|
+
)}
|
|
298
|
+
{(order?.status === 3) && order?.delivery_type === 1 && (
|
|
299
|
+
<View style={{ paddingVertical: 20, marginBottom: 20 }}>
|
|
300
|
+
<OButton
|
|
301
|
+
style={styles.btnPickUp}
|
|
302
|
+
textStyle={{ color: theme.colors.white }}
|
|
303
|
+
text={t('ORDER_NOT_READY', 'Order not ready')}
|
|
304
|
+
onClick={() =>
|
|
305
|
+
handleChangeOrderStatus && handleChangeOrderStatus(14)
|
|
306
|
+
}
|
|
307
|
+
imgLeftStyle={{ tintColor: theme.colors.backArrow }}
|
|
308
|
+
bgColor={theme.colors.red}
|
|
309
|
+
/>
|
|
310
|
+
</View>
|
|
311
|
+
)}
|
|
312
|
+
</>
|
|
313
|
+
|
|
314
|
+
<OModal
|
|
315
|
+
open={openModalForBusiness}
|
|
316
|
+
order={order}
|
|
317
|
+
title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id}`}
|
|
318
|
+
entireModal
|
|
319
|
+
onClose={() => handleCloseModal()}>
|
|
320
|
+
<Chat
|
|
321
|
+
type={
|
|
322
|
+
openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
|
|
323
|
+
}
|
|
324
|
+
orderId={order?.id}
|
|
325
|
+
messages={messages}
|
|
326
|
+
order={order}
|
|
327
|
+
setMessages={setMessages}
|
|
328
|
+
/>
|
|
329
|
+
</OModal>
|
|
330
|
+
|
|
331
|
+
<OModal
|
|
332
|
+
open={openModalForAccept}
|
|
333
|
+
onClose={() => setOpenModalForAccept(false)}
|
|
334
|
+
entireModal
|
|
335
|
+
customClose>
|
|
336
|
+
<AcceptOrRejectOrder
|
|
337
|
+
handleUpdateOrder={handleChangeOrderStatus}
|
|
338
|
+
closeModal={setOpenModalForAccept}
|
|
339
|
+
customerCellphone={order?.customer?.cellphone}
|
|
340
|
+
loading={loading}
|
|
341
|
+
action={actionOrder}
|
|
342
|
+
orderId={order?.id}
|
|
343
|
+
notShowCustomerPhone
|
|
344
|
+
actions={actions}
|
|
345
|
+
titleAccept={titleAccept}
|
|
346
|
+
titleReject={titleReject}
|
|
347
|
+
appTitle={appTitle}
|
|
348
|
+
/>
|
|
349
|
+
</OModal>
|
|
350
|
+
|
|
351
|
+
<OModal
|
|
352
|
+
open={openModalForMapView}
|
|
353
|
+
onClose={() => handleOpenMapView()}
|
|
354
|
+
entireModal
|
|
355
|
+
customClose>
|
|
356
|
+
<DriverMap
|
|
357
|
+
navigation={navigation}
|
|
358
|
+
order={order}
|
|
359
|
+
orderStatus={getOrderStatus(order?.status, t)?.value || ''}
|
|
360
|
+
location={locationMarker}
|
|
361
|
+
readOnly
|
|
362
|
+
updateDriverPosition={updateDriverPosition}
|
|
363
|
+
driverUpdateLocation={driverUpdateLocation}
|
|
364
|
+
setDriverUpdateLocation={setDriverUpdateLocation}
|
|
365
|
+
handleViewActionOrder={handleViewActionOrder}
|
|
366
|
+
isBusinessMarker={isBusinessMarker}
|
|
367
|
+
isToFollow={isToFollow}
|
|
368
|
+
showAcceptOrReject={
|
|
369
|
+
showFloatButtonsAcceptOrReject[order?.status]
|
|
370
|
+
}
|
|
371
|
+
handleOpenMapView={handleOpenMapView}
|
|
372
|
+
/>
|
|
373
|
+
</OModal>
|
|
374
|
+
|
|
375
|
+
<View
|
|
376
|
+
style={{
|
|
377
|
+
height:
|
|
378
|
+
order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
|
|
379
|
+
}}
|
|
380
|
+
/>
|
|
381
|
+
</OrderDetailsContainer>
|
|
382
|
+
|
|
383
|
+
{showFloatButtonsPickUp[order?.status] && (
|
|
384
|
+
<FloatingButton
|
|
385
|
+
disabled={loading}
|
|
386
|
+
btnText={t('PICKUP_FAILED', 'Pickup failed')}
|
|
387
|
+
isSecondaryBtn={false}
|
|
388
|
+
secondButtonClick={() =>
|
|
389
|
+
handleChangeOrderStatus && handleChangeOrderStatus(9)
|
|
390
|
+
}
|
|
391
|
+
firstButtonClick={() =>
|
|
392
|
+
handleViewActionOrder && handleViewActionOrder('failed')
|
|
393
|
+
}
|
|
394
|
+
secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
|
|
395
|
+
secondButton={true}
|
|
396
|
+
firstColorCustom={theme.colors.red}
|
|
397
|
+
secondColorCustom={theme.colors.green}
|
|
398
|
+
widthButton={'45%'}
|
|
399
|
+
/>
|
|
400
|
+
)}
|
|
401
|
+
{(order?.status === 9 || order?.status === 19) && (
|
|
402
|
+
<>
|
|
403
|
+
<FloatingButton
|
|
404
|
+
disabled={loading}
|
|
405
|
+
btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
|
|
406
|
+
isSecondaryBtn={false}
|
|
407
|
+
secondButtonClick={() =>
|
|
408
|
+
handleChangeOrderStatus && handleChangeOrderStatus(11)
|
|
409
|
+
}
|
|
410
|
+
firstButtonClick={() =>
|
|
411
|
+
handleViewActionOrder && handleViewActionOrder('failed')
|
|
412
|
+
}
|
|
413
|
+
secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
414
|
+
secondButton={true}
|
|
415
|
+
firstColorCustom={theme.colors.red}
|
|
416
|
+
secondColorCustom={theme.colors.green}
|
|
417
|
+
widthButton={'45%'}
|
|
418
|
+
/>
|
|
419
|
+
</>
|
|
420
|
+
)}
|
|
421
|
+
{showFloatButtonsAcceptOrReject[order?.status] && (
|
|
422
|
+
<FloatingButton
|
|
423
|
+
btnText={t('REJECT', 'Reject')}
|
|
424
|
+
isSecondaryBtn={false}
|
|
425
|
+
secondButtonClick={() => handleViewActionOrder('accept')}
|
|
426
|
+
firstButtonClick={() => handleViewActionOrder('reject')}
|
|
427
|
+
secondBtnText={t('ACCEPT', 'Accept')}
|
|
428
|
+
secondButton={true}
|
|
429
|
+
firstColorCustom={theme.colors.red}
|
|
430
|
+
secondColorCustom={theme.colors.green}
|
|
431
|
+
widthButton={'45%'}
|
|
432
|
+
/>
|
|
433
|
+
)}
|
|
434
|
+
|
|
435
|
+
<Alert
|
|
436
|
+
open={alertState.open}
|
|
437
|
+
onAccept={handleArrowBack}
|
|
438
|
+
onClose={handleArrowBack}
|
|
439
|
+
content={alertState.content}
|
|
440
|
+
title={t('WARNING', 'Warning')}
|
|
441
|
+
/>
|
|
442
|
+
</View>
|
|
443
|
+
)}
|
|
444
|
+
</>
|
|
445
|
+
);
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
export const OrderDetailsDelivery = (props: OrderDetailsParams) => {
|
|
449
|
+
const orderDetailsProps = {
|
|
450
|
+
...props,
|
|
451
|
+
UIComponent: OrderDetailsUI,
|
|
452
|
+
};
|
|
453
|
+
return <OrderDetailsConTableoller {...orderDetailsProps} />;
|
|
454
|
+
};
|