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.
Files changed (105) hide show
  1. package/package.json +1 -1
  2. package/src/components/AddressList/index.tsx +3 -1
  3. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
  4. package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
  5. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
  6. package/themes/business/src/components/OrdersOption/index.tsx +19 -15
  7. package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +389 -0
  8. package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +36 -0
  9. package/themes/business/src/components 2/BusinessController/index.tsx +155 -0
  10. package/themes/business/src/components 2/BusinessController/styles.tsx +19 -0
  11. package/themes/business/src/components 2/Chat/index.tsx +1152 -0
  12. package/themes/business/src/components 2/Chat/styles.tsx +12 -0
  13. package/themes/business/src/components 2/Contacts/index.tsx +299 -0
  14. package/themes/business/src/components 2/Contacts/styles.tsx +42 -0
  15. package/themes/business/src/components 2/DriverMap/index.tsx +525 -0
  16. package/themes/business/src/components 2/FloatingButton/index.tsx +141 -0
  17. package/themes/business/src/components 2/FloatingButton/styles.tsx +35 -0
  18. package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +204 -0
  19. package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +11 -0
  20. package/themes/business/src/components 2/GoogleMap/index.tsx +347 -0
  21. package/themes/business/src/components 2/Home/index.tsx +111 -0
  22. package/themes/business/src/components 2/Home/styles.tsx +27 -0
  23. package/themes/business/src/components 2/LanguageSelector/index.tsx +124 -0
  24. package/themes/business/src/components 2/LanguageSelector/lang_country.json +152 -0
  25. package/themes/business/src/components 2/LanguageSelector/styles.tsx +17 -0
  26. package/themes/business/src/components 2/LoginForm/index.tsx +663 -0
  27. package/themes/business/src/components 2/LoginForm/styles.tsx +48 -0
  28. package/themes/business/src/components 2/LogoutButton/index.tsx +63 -0
  29. package/themes/business/src/components 2/MapView/index.tsx +317 -0
  30. package/themes/business/src/components 2/MessagesOption/index.tsx +337 -0
  31. package/themes/business/src/components 2/MessagesOption/styles.tsx +27 -0
  32. package/themes/business/src/components 2/NewOrderNotification/index.tsx +167 -0
  33. package/themes/business/src/components 2/NewOrderNotification/styles.tsx +8 -0
  34. package/themes/business/src/components 2/NotFoundSource/index.tsx +52 -0
  35. package/themes/business/src/components 2/NotFoundSource/styles.tsx +17 -0
  36. package/themes/business/src/components 2/OrderDetails/Business.tsx +683 -0
  37. package/themes/business/src/components 2/OrderDetails/Delivery.tsx +454 -0
  38. package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +391 -0
  39. package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +148 -0
  40. package/themes/business/src/components 2/OrderDetails/styles.tsx +84 -0
  41. package/themes/business/src/components 2/OrderMessage/index.tsx +344 -0
  42. package/themes/business/src/components 2/OrderMessage/styles.tsx +5 -0
  43. package/themes/business/src/components 2/OrderSummary/index.tsx +700 -0
  44. package/themes/business/src/components 2/OrderSummary/styles.tsx +61 -0
  45. package/themes/business/src/components 2/OrdersOption/index.tsx +755 -0
  46. package/themes/business/src/components 2/OrdersOption/styles.tsx +54 -0
  47. package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +51 -0
  48. package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +8 -0
  49. package/themes/business/src/components 2/OrdersOptionCity/index.tsx +52 -0
  50. package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +8 -0
  51. package/themes/business/src/components 2/OrdersOptionDate/index.tsx +52 -0
  52. package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +8 -0
  53. package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +35 -0
  54. package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +8 -0
  55. package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +50 -0
  56. package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +8 -0
  57. package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +49 -0
  58. package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +8 -0
  59. package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +46 -0
  60. package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +8 -0
  61. package/themes/business/src/components 2/PhoneInputNumber/index.tsx +160 -0
  62. package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +3 -0
  63. package/themes/business/src/components 2/PreviousMessages/index.tsx +304 -0
  64. package/themes/business/src/components 2/PreviousMessages/styles.tsx +32 -0
  65. package/themes/business/src/components 2/PreviousOrders/index.tsx +180 -0
  66. package/themes/business/src/components 2/PreviousOrders/styles.tsx +38 -0
  67. package/themes/business/src/components 2/ProductItemAccordion/index.tsx +301 -0
  68. package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +61 -0
  69. package/themes/business/src/components 2/SearchBar/index.tsx +112 -0
  70. package/themes/business/src/components 2/SignupForm/index.tsx +530 -0
  71. package/themes/business/src/components 2/SignupForm/styles.tsx +16 -0
  72. package/themes/business/src/components 2/StoresList/index.tsx +208 -0
  73. package/themes/business/src/components 2/StoresList/styles.tsx +26 -0
  74. package/themes/business/src/components 2/UserFormDetails/index.tsx +513 -0
  75. package/themes/business/src/components 2/UserFormDetails/styles.tsx +40 -0
  76. package/themes/business/src/components 2/UserProfileForm/index.tsx +496 -0
  77. package/themes/business/src/components 2/UserProfileForm/styles.tsx +36 -0
  78. package/themes/business/src/components 2/VerifyPhone/index.tsx +201 -0
  79. package/themes/business/src/components 2/VerifyPhone/styles.tsx +43 -0
  80. package/themes/business/src/components 2/shared/OAlert.tsx +52 -0
  81. package/themes/business/src/components 2/shared/OButton.tsx +149 -0
  82. package/themes/business/src/components 2/shared/OChatBubble.tsx +100 -0
  83. package/themes/business/src/components 2/shared/ODropDown.tsx +195 -0
  84. package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +328 -0
  85. package/themes/business/src/components 2/shared/OFab.tsx +54 -0
  86. package/themes/business/src/components 2/shared/OIcon.tsx +67 -0
  87. package/themes/business/src/components 2/shared/OIconButton.tsx +127 -0
  88. package/themes/business/src/components 2/shared/OInput.tsx +144 -0
  89. package/themes/business/src/components 2/shared/OLink.tsx +76 -0
  90. package/themes/business/src/components 2/shared/OModal.tsx +275 -0
  91. package/themes/business/src/components 2/shared/OSegment.tsx +86 -0
  92. package/themes/business/src/components 2/shared/OText.tsx +55 -0
  93. package/themes/business/src/components 2/shared/OTextarea.tsx +46 -0
  94. package/themes/business/src/components 2/shared/OToast.tsx +92 -0
  95. package/themes/business/src/components 2/shared/index.tsx +27 -0
  96. package/themes/business/src/types/index.tsx +4 -1
  97. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
  98. package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
  99. package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
  100. package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
  101. package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
  102. package/themes/kiosk/src/components/ProductForm/index.tsx +129 -127
  103. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  104. package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
  105. package/themes/original/src/components/OrderProgress/index.tsx +32 -18
@@ -0,0 +1,525 @@
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import { Dimensions, Platform, SafeAreaView, StyleSheet, View } from 'react-native';
3
+ import MapView, {
4
+ PROVIDER_GOOGLE,
5
+ Marker
6
+ } from 'react-native-maps';
7
+ import Geocoder from 'react-native-geocoding';
8
+ import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
9
+ import { GoogleMapsParams } from '../../types';
10
+ import Alert from '../../providers/AlertProvider';
11
+ import { OIconButton, OIcon, OFab, OText, OLink } from '../shared';
12
+ import Icon from 'react-native-vector-icons/FontAwesome5';
13
+ import { useTheme } from 'styled-components/native';
14
+ import { useLocation } from '../../hooks/useLocation';
15
+ // import MapViewDirections from 'react-native-maps-directions';
16
+ import { FloatingButton } from '../FloatingButton';
17
+
18
+ export const DriverMap = (props: GoogleMapsParams) => {
19
+ const {
20
+ location,
21
+ maxLimitLocation,
22
+ markerTitle,
23
+ handleOpenMapView,
24
+ showAcceptOrReject,
25
+ saveLocation,
26
+ setSaveLocation,
27
+ order,
28
+ isSetInputs,
29
+ orderStatus,
30
+ isBusinessMarker,
31
+ isToFollow,
32
+ handleViewActionOrder,
33
+ updateDriverPosition,
34
+ driverUpdateLocation,
35
+ setDriverUpdateLocation,
36
+ } = props;
37
+
38
+ const theme = useTheme();
39
+ const [, t] = useLanguage();
40
+ const [configState] = useConfig();
41
+ const { width, height } = Dimensions.get('window');
42
+ const ASPECT_RATIO = width / height;
43
+ const mapRef = useRef<MapView>(null);
44
+ const following = useRef<boolean>(true);
45
+ const autoFit = useRef<boolean>(true);
46
+ const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value;
47
+ const [travelTime, setTravelTime] = useState(0);
48
+ const [distancesFromTwoPlacesKm, setDistancesFromTwoPlacesKm] = useState(0);
49
+ const [isMin, setIsMin] = useState(false);
50
+ const [{ parseDate }] = useUtils();
51
+ const mapErrors: any = {
52
+ ERROR_NOT_FOUND_ADDRESS: "Sorry, we couldn't find an address",
53
+ ERROR_MAX_LIMIT_LOCATION_TO: 'Sorry, You can only set the position to',
54
+ };
55
+ const [alertState, setAlertState] = useState<{
56
+ open: boolean;
57
+ content: Array<string>;
58
+ key?: string | null;
59
+ }>({ open: false, content: [], key: null });
60
+
61
+ const {
62
+ hasLocation,
63
+ initialPosition,
64
+ followUserLocation,
65
+ getCurrentLocation,
66
+ userLocation,
67
+ stopFollowUserLocation,
68
+ } = useLocation();
69
+
70
+ const origin = {
71
+ latitude: initialPosition.latitude,
72
+ longitude: initialPosition.longitude,
73
+ };
74
+ const destination = { latitude: location.lat, longitude: location.lng };
75
+
76
+ useEffect(() => {
77
+ if (isToFollow) {
78
+ fitCoordinates();
79
+ followUserLocation();
80
+
81
+ return () => {
82
+ stopFollowUserLocation();
83
+ };
84
+ }
85
+ }, []);
86
+
87
+ const setMapErrors = (errKey: string) => {
88
+ setAlertState({
89
+ open: true,
90
+ content: !(errKey === 'ERROR_MAX_LIMIT_LOCATION_TO')
91
+ ? [t(errKey, mapErrors[errKey])]
92
+ : [
93
+ `${t(errKey, mapErrors[errKey])} ${maxLimitLocation} ${t(
94
+ 'METTERS',
95
+ 'meters',
96
+ )}`,
97
+ ],
98
+ key: errKey,
99
+ });
100
+ };
101
+
102
+ const closeAlert = () => {
103
+ setAlertState({
104
+ open: false,
105
+ content: [],
106
+ });
107
+ };
108
+
109
+ const calculateDistance = (
110
+ pointA: { lat: number; lng: number },
111
+ pointB: { latitude: number; longitude: number },
112
+ ) => {
113
+ const lat1 = pointA.lat;
114
+ const lon1 = pointA.lng;
115
+
116
+ const lat2 = pointB.latitude;
117
+ const lon2 = pointB.longitude;
118
+
119
+ const R = 6371e3;
120
+ const φ1 = lat1 * (Math.PI / 180);
121
+ const φ2 = lat2 * (Math.PI / 180);
122
+ const Δφ = (lat2 - lat1) * (Math.PI / 180);
123
+ const Δλ = (lon2 - lon1) * (Math.PI / 180);
124
+
125
+ const a =
126
+ Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
127
+ Math.cos(φ1) * Math.cos(φ2) * (Math.sin(Δλ / 2) * Math.sin(Δλ / 2));
128
+
129
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
130
+
131
+ const distance = R * c;
132
+ const distanceInKm = distance / 1000;
133
+ const estimatedTimeTravel = distance / userLocation.speed / 60;
134
+ const time =
135
+ estimatedTimeTravel > 60 ? estimatedTimeTravel / 60 : estimatedTimeTravel;
136
+ setIsMin(estimatedTimeTravel < 60);
137
+ const timeEstimated = userLocation.speed > 0 ? time : travelTime;
138
+ setDistancesFromTwoPlacesKm(distanceInKm);
139
+ setTravelTime(timeEstimated);
140
+ return distance;
141
+ };
142
+
143
+ useEffect(() => {
144
+ if (driverUpdateLocation.error) {
145
+ stopFollowUserLocation();
146
+ setAlertState({
147
+ open: true,
148
+ content: [
149
+ `${driverUpdateLocation.error[0] || driverUpdateLocation.error}. ${t(
150
+ 'TRY_AGAIN',
151
+ 'Try Again',
152
+ )}`,
153
+ ],
154
+ });
155
+ }
156
+ }, [driverUpdateLocation.error]);
157
+
158
+ useEffect(() => {
159
+ if (driverUpdateLocation.error) return;
160
+
161
+ calculateDistance(
162
+ { lat: userLocation.latitude, lng: userLocation.longitude },
163
+ destination,
164
+ );
165
+ // geocodePosition(userLocation);
166
+
167
+ if (!following.current) return;
168
+ fitCoordinates();
169
+
170
+ const { latitude, longitude } = userLocation;
171
+
172
+ mapRef.current?.animateCamera({
173
+ center: { latitude, longitude },
174
+ });
175
+
176
+ }, [userLocation]);
177
+
178
+ const handleArrowBack: any = () => {
179
+ setDriverUpdateLocation?.({
180
+ ...driverUpdateLocation,
181
+ error: null,
182
+ newLocation: null,
183
+ });
184
+ handleOpenMapView && handleOpenMapView();
185
+ };
186
+
187
+ const centerPosition = async () => {
188
+ const { latitude, longitude } = await getCurrentLocation();
189
+
190
+ following.current = true;
191
+ if (mapRef.current) {
192
+ mapRef.current.animateToRegion(
193
+ {
194
+ latitude: latitude,
195
+ longitude: longitude,
196
+ latitudeDelta: 0.001,
197
+ longitudeDelta: 0.001 * ASPECT_RATIO,
198
+ },
199
+ 2000,
200
+ );
201
+
202
+ // mapRef.current?.animateCamera({
203
+ // center: { latitude, longitude },
204
+ // });
205
+ }
206
+ };
207
+
208
+ const colors: any = {
209
+ //BLUE
210
+ 0: theme.colors.statusOrderBlue,
211
+ 3: theme.colors.statusOrderBlue,
212
+ 4: theme.colors.statusOrderBlue,
213
+ 7: theme.colors.statusOrderBlue,
214
+ 8: theme.colors.statusOrderBlue,
215
+ 9: theme.colors.statusOrderBlue,
216
+ 13: theme.colors.statusOrderBlue,
217
+ 14: theme.colors.statusOrderBlue,
218
+ 18: theme.colors.statusOrderBlue,
219
+ 19: theme.colors.statusOrderBlue,
220
+ 20: theme.colors.statusOrderBlue,
221
+ 21: theme.colors.statusOrderBlue,
222
+ //GREEN
223
+ 1: theme.colors.statusOrderGreen,
224
+ 11: theme.colors.statusOrderGreen,
225
+ 15: theme.colors.statusOrderGreen,
226
+ //RED
227
+ 2: theme.colors.statusOrderRed,
228
+ 5: theme.colors.statusOrderRed,
229
+ 6: theme.colors.statusOrderRed,
230
+ 10: theme.colors.statusOrderRed,
231
+ 12: theme.colors.statusOrderRed,
232
+ 16: theme.colors.statusOrderRed,
233
+ 17: theme.colors.statusOrderRed,
234
+ };
235
+
236
+ const fitCoordinates = () => {
237
+ if (mapRef.current) {
238
+ mapRef.current.fitToCoordinates(
239
+ [
240
+ { latitude: location.lat, longitude: location.lng },
241
+ {
242
+ latitude: initialPosition.latitude,
243
+ longitude: initialPosition.longitude,
244
+ },
245
+ ],
246
+ {
247
+ edgePadding: { top: 80, right: 80, bottom: 80, left: 80 },
248
+ animated: true,
249
+ },
250
+ );
251
+ }
252
+ };
253
+
254
+ useEffect(() => {
255
+ const interval = setInterval(() => {
256
+ if (initialPosition.latitude !== 0 && autoFit.current) {
257
+ if (mapRef.current) {
258
+ fitCoordinates();
259
+ autoFit.current = false;
260
+ }
261
+ }
262
+ }, 1000);
263
+ return () => clearInterval(interval);
264
+ }, [initialPosition]);
265
+
266
+ const fitCoordinatesZoom = () => {
267
+ following.current = false;
268
+ fitCoordinates();
269
+ };
270
+
271
+ const styles = StyleSheet.create({
272
+ map: {
273
+ flex: 1,
274
+ ...StyleSheet.absoluteFillObject,
275
+ },
276
+ image: {
277
+ borderRadius: 50,
278
+ },
279
+ view: {
280
+ width: 25,
281
+ position: 'absolute',
282
+ top: 6,
283
+ left: 6,
284
+ bottom: 0,
285
+ right: 0,
286
+ },
287
+ driverIcon: {
288
+ height: 25,
289
+ width: 25,
290
+ backgroundColor: theme.colors.white,
291
+ borderRadius: 100,
292
+ justifyContent: 'center',
293
+ alignItems: 'center',
294
+ },
295
+ buttonBack: {
296
+ borderWidth: 0,
297
+ maxWidth: 40,
298
+ alignItems: 'flex-start',
299
+ justifyContent: 'flex-end',
300
+ },
301
+ facContainer: {
302
+ position: 'absolute',
303
+ top: 0,
304
+ zIndex: 9999,
305
+ width: '100%',
306
+ backgroundColor: theme.colors.white,
307
+ paddingHorizontal: 30,
308
+ paddingTop: 30,
309
+ },
310
+ facOrderStatus: {
311
+ flexDirection: 'row',
312
+ borderBottomWidth: 11,
313
+ minHeight: 70,
314
+ borderBottomColor: theme.colors.inputChat,
315
+ paddingVertical: 5,
316
+ },
317
+ facDistance: {
318
+ flexDirection: 'row',
319
+ alignItems: 'center',
320
+ minHeight: 75,
321
+ },
322
+ arrowDistance: {
323
+ borderWidth: 0,
324
+ },
325
+ });
326
+
327
+ return (
328
+ <SafeAreaView style={{ flex: 1 }}>
329
+ <View style={{ flex: 1 }}>
330
+ <View style={{ flex: 1 }}>
331
+ <MapView
332
+ ref={mapRef}
333
+ provider={PROVIDER_GOOGLE}
334
+ initialRegion={{
335
+ latitude: initialPosition.latitude,
336
+ longitude: initialPosition.longitude,
337
+ latitudeDelta: 0.001,
338
+ longitudeDelta: 0.001 * ASPECT_RATIO,
339
+ }}
340
+ style={{ flex: 1 }}
341
+ // showsUserLocation
342
+
343
+ zoomTapEnabled
344
+ // onRegionChangeComplete={
345
+ // !readOnly
346
+ // ? coordinates => handleChangeRegion(coordinates)
347
+ // : () => {}
348
+ // }
349
+ zoomEnabled
350
+ zoomControlEnabled
351
+ cacheEnabled
352
+ moveOnMarkerPress
353
+ onTouchStart={() => (following.current = false)}>
354
+ {location ? (
355
+ <>
356
+ <Marker
357
+ coordinate={{
358
+ latitude: location.lat,
359
+ longitude: location.lng,
360
+ }}
361
+ title={location.title}>
362
+ <Icon
363
+ name="map-marker"
364
+ size={50}
365
+ color={theme.colors.primary}
366
+ />
367
+ <View style={styles.view}>
368
+ <OIcon
369
+ style={styles.image}
370
+ url={location.icon}
371
+ width={25}
372
+ height={25}
373
+ />
374
+ </View>
375
+ </Marker>
376
+ <Marker coordinate={userLocation}>
377
+ <View style={styles.driverIcon}>
378
+ <OIcon
379
+ style={styles.image}
380
+ src={theme.images.general.driverImage}
381
+ width={25}
382
+ height={25}
383
+ />
384
+ </View>
385
+ </Marker>
386
+ </>
387
+ ) : (
388
+ <Marker
389
+ coordinate={{
390
+ latitude: userLocation.latitude,
391
+ longitude: userLocation.longitude,
392
+ }}
393
+ title={markerTitle || t('YOUR_LOCATION', 'Your Location')}
394
+ />
395
+ )}
396
+ </MapView>
397
+ </View>
398
+
399
+ <OFab
400
+ iconName="globe-sharp"
401
+ onPress={fitCoordinatesZoom}
402
+ style={{
403
+ position: 'absolute',
404
+ bottom: showAcceptOrReject ? 115 : 75,
405
+ right: 20,
406
+ }}
407
+ />
408
+ <OFab
409
+ iconName="car-sport-sharp"
410
+ onPress={centerPosition}
411
+ style={{
412
+ position: 'absolute',
413
+ bottom: showAcceptOrReject ? 80 : 35,
414
+ right: 20,
415
+ }}
416
+ />
417
+ <View style={styles.facContainer}>
418
+ <View style={styles.facOrderStatus}>
419
+ <View
420
+ style={{
421
+ width: '15%',
422
+ justifyContent: 'flex-start',
423
+ alignItems: 'flex-start',
424
+ paddingBottom: 10,
425
+ marginRight: 10,
426
+ }}>
427
+ <OIconButton
428
+ icon={theme.images.general.close}
429
+ iconStyle={{
430
+ width: 13,
431
+ height: 13,
432
+ }}
433
+ style={styles.buttonBack}
434
+ onClick={() => handleArrowBack()}
435
+ />
436
+ </View>
437
+ <View style={{ width: '85%', paddingRight: 10, paddingBottom: 10 }}>
438
+ <OText size={12} color={theme.colors.textGray}>
439
+ {order?.delivery_datetime_utc
440
+ ? parseDate(order?.delivery_datetime_utc)
441
+ : parseDate(order?.delivery_datetime, { utc: false })}
442
+ {` - ${order?.paymethod?.name}`}
443
+ </OText>
444
+ <OText weight="bold">
445
+ {t('INVOICE_ORDER_NO', 'Order No.')} {order?.id}
446
+ {` ${t('IS', 'is')} `}
447
+ <OText
448
+ size={16}
449
+ numberOfLines={2}
450
+ color={colors[order?.status] || theme.colors.statusOrderBlue}>
451
+ {`${orderStatus}`}
452
+ </OText>
453
+ </OText>
454
+ </View>
455
+ </View>
456
+
457
+ <View style={styles.facDistance}>
458
+ <View
459
+ style={{
460
+ width: '15%',
461
+ alignItems: 'center',
462
+ marginRight: 10,
463
+ }}>
464
+ <OIcon
465
+ src={theme.images.general.arrow_distance}
466
+ style={styles.arrowDistance}
467
+ />
468
+ <OText size={12} numberOfLines={3}>{`${(
469
+ distancesFromTwoPlacesKm * 3280.84
470
+ ).toFixed(0)} ${t('FT', 'Ft')}`}</OText>
471
+ </View>
472
+ <View style={{ width: '75%', paddingRight: 20 }}>
473
+ <OText
474
+ color={theme.colors.unselectText}
475
+ size={13}
476
+ numberOfLines={2}
477
+ adjustsFontSizeToFit>
478
+ {`${travelTime.toFixed(2)} - ${
479
+ isMin ? t('MINNUTES', 'mins') : t('HOURS', 'hours')
480
+ } ${distancesFromTwoPlacesKm.toFixed(2)} km`}
481
+ </OText>
482
+ </View>
483
+ </View>
484
+ </View>
485
+ <View>
486
+ <OLink
487
+ PressStyle={{paddingHorizontal: 80, paddingVertical: 10,bottom: showAcceptOrReject ? 80 : 0}}
488
+ hasButton
489
+ url={Platform.select({
490
+ ios: `maps:0,0?q=${destination.latitude},${destination.longitude}`,
491
+ android: `geo:0,0?q=${destination.latitude},${destination.longitude}`,
492
+ })}
493
+ shorcut={t('SHOW_IN_OTHER_MAPS', 'Show in other maps')}
494
+ />
495
+ </View>
496
+ {showAcceptOrReject && (
497
+ <FloatingButton
498
+ btnText={t('REJECT', 'Reject')}
499
+ isSecondaryBtn={false}
500
+ secondButtonClick={() =>
501
+ handleViewActionOrder && handleViewActionOrder('accept')
502
+ }
503
+ firstButtonClick={() =>
504
+ handleViewActionOrder && handleViewActionOrder('reject')
505
+ }
506
+ secondBtnText={t('ACCEPT', 'Accept')}
507
+ secondButton={true}
508
+ firstColorCustom={theme.colors.red}
509
+ secondColorCustom={theme.colors.green}
510
+ widthButton={'45%'}
511
+ isPadding
512
+ />
513
+ )}
514
+
515
+ <Alert
516
+ open={alertState.open}
517
+ onAccept={closeAlert}
518
+ onClose={closeAlert}
519
+ content={alertState.content}
520
+ title={t('ERROR', 'Error')}
521
+ />
522
+ </View>
523
+ </SafeAreaView>
524
+ );
525
+ };
@@ -0,0 +1,141 @@
1
+ import React from 'react';
2
+ import { FloatingButton as FloatingButtonController } from 'ordering-components/native';
3
+ import { FloatingButtonParams } from '../../types';
4
+ import { Container, Button } from './styles';
5
+ import { OText } from '../shared';
6
+ import { StyleSheet, Platform, View } from 'react-native';
7
+ import { useTheme } from 'styled-components/native';
8
+
9
+ const FloatingButtonUI = (props: FloatingButtonParams) => {
10
+ const {
11
+ btnLeftValue,
12
+ btnRightValue,
13
+ btnLeftValueShow,
14
+ btnRightValueShow,
15
+ btnText,
16
+ colorTxt1,
17
+ secondBtnText,
18
+ firstColorCustom,
19
+ secondColorCustom,
20
+ secondButtonClick,
21
+ firstButtonClick,
22
+ disabled,
23
+ color,
24
+ isSecondaryBtn,
25
+ secondButton,
26
+ widthButton,
27
+ isPadding,
28
+ } = props;
29
+
30
+ const theme = useTheme();
31
+
32
+ const styles = StyleSheet.create({
33
+ primaryBtn: {
34
+ backgroundColor: theme.colors.primary,
35
+ },
36
+ secodaryBtn: {
37
+ backgroundColor: theme.colors.textSecondary,
38
+ },
39
+ btnTextStyle: {
40
+ fontFamily: 'Poppins',
41
+ fontStyle: 'normal',
42
+ fontWeight: 'normal',
43
+ fontSize: 18,
44
+ paddingHorizontal: 10,
45
+ paddingVertical: 10,
46
+ position: 'absolute',
47
+ width: '100%',
48
+ left: 0,
49
+ textAlign: 'center',
50
+ },
51
+ });
52
+
53
+ return (
54
+ <Container
55
+ isIos={Platform.OS === 'ios'}
56
+ paddingBottomIos={props.paddingBottomIos}
57
+ style={{ paddingHorizontal: props.isPadding ? 30 : 0 }}>
58
+ <View
59
+ style={{
60
+ flexDirection: 'row',
61
+ width: '100%',
62
+ justifyContent: 'space-between',
63
+ }}>
64
+ <Button
65
+ secondButton={secondButton}
66
+ style={[
67
+ {
68
+ borderWidth: colorTxt1 ? 1 : 0,
69
+ borderColor: colorTxt1 ? colorTxt1 : null,
70
+ },
71
+ secondButton
72
+ ? { backgroundColor: firstColorCustom || styles.primaryBtn }
73
+ : color
74
+ ? { backgroundColor: color }
75
+ : styles.primaryBtn,
76
+ ,
77
+ { width: widthButton },
78
+ ]}
79
+ onPress={firstButtonClick}
80
+ disabled={disabled}>
81
+ <OText color={theme.colors.white} size={16} mLeft={20}>
82
+ {btnLeftValueShow ? btnLeftValue : ''}
83
+ </OText>
84
+
85
+ <OText
86
+ style={styles.btnTextStyle}
87
+ color={colorTxt1 ? colorTxt1 : theme.colors.white}
88
+ numberOfLines={2}
89
+ adjustsFontSizeToFit>
90
+ {btnText}
91
+ </OText>
92
+
93
+ <OText color={theme.colors.white} size={16} mRight={20}>
94
+ {btnRightValueShow ? btnRightValue : ''}
95
+ </OText>
96
+ </Button>
97
+
98
+ {secondButton && (
99
+ <Button
100
+ secondButton={secondButton}
101
+ style={[
102
+ secondButton
103
+ ? { backgroundColor: secondColorCustom || styles.secodaryBtn }
104
+ : color
105
+ ? color
106
+ : styles.secodaryBtn,
107
+ ,
108
+ { width: widthButton },
109
+ ]}
110
+ onPress={secondButtonClick}
111
+ disabled={disabled}>
112
+ <OText color={theme.colors.white} size={16} mLeft={20}>
113
+ {btnLeftValueShow ? btnLeftValue : ''}
114
+ </OText>
115
+
116
+ <OText
117
+ style={styles.btnTextStyle}
118
+ color={theme.colors.white}
119
+ numberOfLines={2}
120
+ adjustsFontSizeToFit>
121
+ {secondBtnText}
122
+ </OText>
123
+
124
+ <OText color={theme.colors.white} size={16} mRight={20}>
125
+ {btnRightValueShow ? btnRightValue : ''}
126
+ </OText>
127
+ </Button>
128
+ )}
129
+ </View>
130
+ </Container>
131
+ );
132
+ };
133
+
134
+ export const FloatingButton = (props: FloatingButtonParams) => {
135
+ const floatingButtonProps = {
136
+ ...props,
137
+ UIComponent: FloatingButtonUI,
138
+ };
139
+
140
+ return <FloatingButtonController {...floatingButtonProps} />;
141
+ };
@@ -0,0 +1,35 @@
1
+ import styled, { css } from 'styled-components/native';
2
+
3
+ export const Container = styled.View`
4
+ flex-direction: row;
5
+ position: absolute;
6
+ flex: 1;
7
+ bottom: 0px;
8
+ left: 0;
9
+ padding-vertical: 10px;
10
+ width: 100%;
11
+ display: flex;
12
+ justify-content: center;
13
+ background-color: #fff;
14
+ z-index: 1000;
15
+ ${(props: any) =>
16
+ props.isIos &&
17
+ css`
18
+ padding-bottom: ${(props: any) => props.paddingBottomIos ? `${props.paddingBottomIos}px` : '5px'};
19
+ `}
20
+ `;
21
+
22
+ export const Button = styled.TouchableOpacity`
23
+ position: relative;
24
+ display: flex;
25
+ justify-content: space-between;
26
+ align-items: center;
27
+ border-radius: 7px;
28
+ height: 50px;
29
+
30
+ ${(props: any) =>
31
+ css`
32
+ width: ${props.secondButton ? '45%' : '100%'};
33
+ `}
34
+ flex-direction: row;
35
+ `;