ordering-ui-react-native 0.12.57 → 0.12.58

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 (175) hide show
  1. package/package.json +1 -1
  2. package/themes/single-business/src/components/Cart/index.tsx +91 -15
  3. package/themes/single-business/src/components/Cart/styles.tsx +39 -0
  4. package/themes/single-business/src/components/CartContent/index.tsx +56 -52
  5. package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
  6. package/themes/franchises/index.tsx +0 -111
  7. package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
  8. package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
  9. package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
  10. package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
  11. package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
  12. package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
  13. package/themes/franchises/src/components/AddressList/index.tsx +0 -338
  14. package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
  15. package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
  16. package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
  17. package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
  18. package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
  19. package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
  20. package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
  21. package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
  22. package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
  23. package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
  24. package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
  25. package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
  26. package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
  27. package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
  28. package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
  29. package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
  30. package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
  31. package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
  32. package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
  33. package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
  34. package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
  35. package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
  36. package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
  37. package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
  38. package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
  39. package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
  40. package/themes/franchises/src/components/Cart/index.tsx +0 -332
  41. package/themes/franchises/src/components/Cart/styles.tsx +0 -28
  42. package/themes/franchises/src/components/CartContent/index.tsx +0 -60
  43. package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
  44. package/themes/franchises/src/components/Checkout/index.tsx +0 -664
  45. package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
  46. package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
  47. package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
  48. package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
  49. package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
  50. package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
  51. package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
  52. package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
  53. package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
  54. package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
  55. package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
  56. package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
  57. package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
  58. package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
  59. package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
  60. package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
  61. package/themes/franchises/src/components/Help/index.tsx +0 -56
  62. package/themes/franchises/src/components/Help/styles.tsx +0 -11
  63. package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
  64. package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
  65. package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
  66. package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
  67. package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
  68. package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
  69. package/themes/franchises/src/components/Home/index.tsx +0 -102
  70. package/themes/franchises/src/components/Home/styles.tsx +0 -18
  71. package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
  72. package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
  73. package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
  74. package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
  75. package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
  76. package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
  77. package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
  78. package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
  79. package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
  80. package/themes/franchises/src/components/Messages/index.tsx +0 -359
  81. package/themes/franchises/src/components/Messages/styles.tsx +0 -20
  82. package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
  83. package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
  84. package/themes/franchises/src/components/NavBar/index.tsx +0 -129
  85. package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
  86. package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
  87. package/themes/franchises/src/components/Notifications/index.tsx +0 -120
  88. package/themes/franchises/src/components/Notifications/styles.ts +0 -21
  89. package/themes/franchises/src/components/OrderDetails/index.tsx +0 -828
  90. package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
  91. package/themes/franchises/src/components/OrderSummary/index.tsx +0 -266
  92. package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
  93. package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
  94. package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
  95. package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
  96. package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
  97. package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
  98. package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
  99. package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
  100. package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
  101. package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
  102. package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
  103. package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
  104. package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
  105. package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
  106. package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
  107. package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
  108. package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
  109. package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
  110. package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
  111. package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
  112. package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
  113. package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
  114. package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
  115. package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
  116. package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
  117. package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
  118. package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
  119. package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
  120. package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
  121. package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
  122. package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
  123. package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
  124. package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
  125. package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
  126. package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
  127. package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
  128. package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
  129. package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
  130. package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
  131. package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
  132. package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
  133. package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
  134. package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
  135. package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
  136. package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
  137. package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
  138. package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
  139. package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
  140. package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
  141. package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
  142. package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
  143. package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
  144. package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
  145. package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
  146. package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
  147. package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
  148. package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
  149. package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
  150. package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
  151. package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
  152. package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
  153. package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
  154. package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
  155. package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
  156. package/themes/franchises/src/components/shared/OButton.tsx +0 -132
  157. package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
  158. package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
  159. package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
  160. package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
  161. package/themes/franchises/src/components/shared/OInput.tsx +0 -113
  162. package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
  163. package/themes/franchises/src/components/shared/OModal.tsx +0 -172
  164. package/themes/franchises/src/components/shared/OText.tsx +0 -52
  165. package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
  166. package/themes/franchises/src/components/shared/OToast.tsx +0 -93
  167. package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
  168. package/themes/franchises/src/components/shared/index.tsx +0 -29
  169. package/themes/franchises/src/config/constants.tsx +0 -57
  170. package/themes/franchises/src/layouts/Container.tsx +0 -23
  171. package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
  172. package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
  173. package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
  174. package/themes/franchises/src/types/index.tsx +0 -445
  175. package/themes/franchises/src/utils/index.tsx +0 -222
@@ -1,828 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { View, StyleSheet, BackHandler } from 'react-native';
3
- import Spinner from 'react-native-loading-spinner-overlay';
4
- import LinearGradient from 'react-native-linear-gradient';
5
- import { Messages } from '../Messages';
6
- import {
7
- useLanguage,
8
- OrderDetails as OrderDetailsConTableoller,
9
- useUtils,
10
- useConfig,
11
- useSession,
12
- } from 'ordering-components/native';
13
- import { useTheme } from 'styled-components/native';
14
- import {
15
- OrderDetailsContainer,
16
- Header,
17
- OrderContent,
18
- OrderBusiness,
19
- Logo,
20
- OrderData,
21
- OrderInfo,
22
- OrderStatus,
23
- StaturBar,
24
- StatusImage,
25
- OrderCustomer,
26
- CustomerPhoto,
27
- InfoBlock,
28
- HeaderInfo,
29
- Customer,
30
- OrderProducts,
31
- Table,
32
- OrderBill,
33
- Total,
34
- NavBack,
35
- Icons,
36
- OrderDriver,
37
- Map,
38
- } from './styles';
39
- import { OButton, OIcon, OModal, OText } from '../shared';
40
- import { ProductItemAccordion } from '../ProductItemAccordion';
41
- import { TouchableOpacity } from 'react-native-gesture-handler';
42
- import { OrderDetailsParams } from '../../types';
43
- import { USER_TYPE } from '../../config/constants';
44
- import { GoogleMap } from '../GoogleMap';
45
- import { verifyDecimals } from '../../utils';
46
- import { OSRow } from '../OrderSummary/styles';
47
- import { TaxInformation } from '../TaxInformation';
48
- import AntIcon from 'react-native-vector-icons/AntDesign'
49
-
50
- export const OrderDetailsUI = (props: OrderDetailsParams) => {
51
- const {
52
- navigation,
53
- messages,
54
- setMessages,
55
- readMessages,
56
- messagesReadList,
57
- isFromCheckout,
58
- driverLocation,
59
- } = props;
60
-
61
- const theme = useTheme();
62
-
63
- const styles = StyleSheet.create({
64
- rowDirection: {
65
- flexDirection: 'row',
66
- },
67
- statusBar: {
68
- height: 12,
69
- },
70
- logo: {
71
- width: 75,
72
- height: 75,
73
- borderRadius: 10,
74
- },
75
- textBold: {
76
- fontWeight: 'bold',
77
- },
78
- btnBackArrow: {
79
- borderWidth: 0,
80
- backgroundColor: theme.colors.clear,
81
- borderColor: theme.colors.clear,
82
- shadowColor: theme.colors.clear,
83
- alignItems: 'flex-start',
84
- justifyContent: 'flex-start',
85
- paddingLeft: 0,
86
- height: 30,
87
- width: 40,
88
- },
89
- });
90
-
91
- const [, t] = useLanguage();
92
- const [{ parsePrice, parseNumber, parseDate }] = useUtils();
93
- const [{ user }] = useSession();
94
- const [{ configs }] = useConfig();
95
-
96
- const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
97
- const [openModalForDriver, setOpenModalForDriver] = useState(false);
98
- const [unreadAlert, setUnreadAlert] = useState({
99
- business: false,
100
- driver: false,
101
- });
102
- const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
103
-
104
- const { order, businessData } = props.order;
105
-
106
- const getOrderStatus = (s: string) => {
107
- const status = parseInt(s);
108
- const orderStatus = [
109
- {
110
- key: 0,
111
- value: t('PENDING', 'Pending'),
112
- slug: 'PENDING',
113
- percentage: 0.25,
114
- image: theme.images.order.status0,
115
- },
116
- {
117
- key: 1,
118
- value: t('COMPLETED', 'Completed'),
119
- slug: 'COMPLETED',
120
- percentage: 1,
121
- image: theme.images.order.status1,
122
- },
123
- {
124
- key: 2,
125
- value: t('REJECTED', 'Rejected'),
126
- slug: 'REJECTED',
127
- percentage: 0,
128
- image: theme.images.order.status2,
129
- },
130
- {
131
- key: 3,
132
- value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
133
- slug: 'DRIVER_IN_BUSINESS',
134
- percentage: 0.6,
135
- image: theme.images.order.status3,
136
- },
137
- {
138
- key: 4,
139
- value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
140
- slug: 'PREPARATION_COMPLETED',
141
- percentage: 0.7,
142
- image: theme.images.order.status4,
143
- },
144
- {
145
- key: 5,
146
- value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
147
- slug: 'REJECTED_BY_BUSINESS',
148
- percentage: 0,
149
- image: theme.images.order.status5,
150
- },
151
- {
152
- key: 6,
153
- value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
154
- slug: 'REJECTED_BY_DRIVER',
155
- percentage: 0,
156
- image: theme.images.order.status6,
157
- },
158
- {
159
- key: 7,
160
- value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
161
- slug: 'ACCEPTED_BY_BUSINESS',
162
- percentage: 0.35,
163
- image: theme.images.order.status7,
164
- },
165
- {
166
- key: 8,
167
- value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
168
- slug: 'ACCEPTED_BY_DRIVER',
169
- percentage: 0.45,
170
- image: theme.images.order.status8,
171
- },
172
- {
173
- key: 9,
174
- value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
175
- slug: 'PICK_UP_COMPLETED_BY_DRIVER',
176
- percentage: 0.8,
177
- image: theme.images.order.status9,
178
- },
179
- {
180
- key: 10,
181
- value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
182
- slug: 'PICK_UP_FAILED_BY_DRIVER',
183
- percentage: 0,
184
- image: theme.images.order.status10,
185
- },
186
- {
187
- key: 11,
188
- value: t(
189
- 'DELIVERY_COMPLETED_BY_DRIVER',
190
- 'Delivery completed by driver',
191
- ),
192
- slug: 'DELIVERY_COMPLETED_BY_DRIVER',
193
- percentage: 1,
194
- image: theme.images.order.status11,
195
- },
196
- {
197
- key: 12,
198
- value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
199
- slug: 'DELIVERY_FAILED_BY_DRIVER',
200
- percentage: 0,
201
- image: theme.images.order.status12,
202
- },
203
- {
204
- key: 13,
205
- value: t('PREORDER', 'PreOrder'),
206
- slug: 'PREORDER',
207
- percentage: 0,
208
- image: theme.images.order.status13,
209
- },
210
- {
211
- key: 14,
212
- value: t('ORDER_NOT_READY', 'Order not ready'),
213
- slug: 'ORDER_NOT_READY',
214
- percentage: 0,
215
- image: theme.images.order.status13,
216
- },
217
- {
218
- key: 15,
219
- value: t(
220
- 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
221
- 'Order picked up completed by customer',
222
- ),
223
- slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
224
- percentage: 100,
225
- image: theme.images.order.status1,
226
- },
227
- {
228
- key: 16,
229
- value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
230
- slug: 'CANCELLED_BY_CUSTOMER',
231
- percentage: 0,
232
- image: theme.images.order.status2,
233
- },
234
- {
235
- key: 17,
236
- value: t(
237
- 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
238
- 'Order not picked up by customer',
239
- ),
240
- slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
241
- percentage: 0,
242
- image: theme.images.order.status2,
243
- },
244
- {
245
- key: 18,
246
- value: t(
247
- 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
248
- 'Driver almost arrived to business',
249
- ),
250
- slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
251
- percentage: 0.15,
252
- image: theme.images.order.status3,
253
- },
254
- {
255
- key: 19,
256
- value: t(
257
- 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
258
- 'Driver almost arrived to customer',
259
- ),
260
- slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
261
- percentage: 0.9,
262
- image: theme.images.order.status11,
263
- },
264
- {
265
- key: 20,
266
- value: t(
267
- 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
268
- 'Customer almost arrived to business',
269
- ),
270
- slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
271
- percentage: 90,
272
- image: theme.images.order.status7,
273
- },
274
- {
275
- key: 21,
276
- value: t(
277
- 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
278
- 'Customer arrived to business',
279
- ),
280
- slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
281
- percentage: 95,
282
- image: theme.images.order.status7,
283
- },
284
- ];
285
-
286
- const objectStatus = orderStatus.find((o) => o.key === status);
287
-
288
- return objectStatus && objectStatus;
289
- };
290
-
291
- const handleOpenMessagesForBusiness = () => {
292
- setOpenModalForBusiness(true);
293
- readMessages && readMessages();
294
- setUnreadAlert({ ...unreadAlert, business: false });
295
- };
296
-
297
- const handleOpenMessagesForDriver = () => {
298
- setOpenModalForDriver(true);
299
- readMessages && readMessages();
300
- setUnreadAlert({ ...unreadAlert, driver: false });
301
- };
302
-
303
- const unreadMessages = () => {
304
- const length = messages?.messages.length;
305
- const unreadLength = order?.unread_count;
306
- const unreadedMessages = messages.messages.slice(
307
- length - unreadLength,
308
- length,
309
- );
310
- const business = unreadedMessages.some((message: any) =>
311
- message?.can_see?.includes(2),
312
- );
313
- const driver = unreadedMessages.some((message: any) =>
314
- message?.can_see?.includes(4),
315
- );
316
- setUnreadAlert({ business, driver });
317
- };
318
-
319
- const handleCloseModal = () => {
320
- setOpenModalForBusiness(false);
321
- setOpenModalForDriver(false);
322
- };
323
-
324
- const handleArrowBack: any = () => {
325
- if (!isFromCheckout) {
326
- navigation?.canGoBack() && navigation.goBack();
327
- return;
328
- }
329
- navigation.navigate('BottomTab');
330
- };
331
-
332
- const getIncludedTaxes = () => {
333
- if (order?.taxes?.length === 0) {
334
- return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
335
- } else {
336
- return order?.taxes.reduce((taxIncluded: number, tax: any) => {
337
- return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
338
- }, 0)
339
- }
340
- }
341
-
342
- useEffect(() => {
343
- BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
344
- return () => {
345
- BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
346
- };
347
- }, []);
348
-
349
- useEffect(() => {
350
- if (messagesReadList?.length) {
351
- openModalForBusiness
352
- ? setUnreadAlert({ ...unreadAlert, business: false })
353
- : setUnreadAlert({ ...unreadAlert, driver: false });
354
- }
355
- }, [messagesReadList]);
356
-
357
- const locations = [
358
- {
359
- ...order?.driver?.location,
360
- title: t('DRIVER', 'Driver'),
361
- icon:
362
- order?.driver?.photo ||
363
- 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png',
364
- },
365
- {
366
- ...order?.business?.location,
367
- title: order?.business?.name,
368
- icon: order?.business?.logo || theme.images.dummies.businessLogo,
369
- },
370
- {
371
- ...order?.customer?.location,
372
- title: t('YOUR_LOCATION', 'Your Location'),
373
- icon:
374
- order?.customer?.photo ||
375
- 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
376
- },
377
- ];
378
-
379
- useEffect(() => {
380
- if (driverLocation) {
381
- locations[0] = driverLocation;
382
- }
383
- }, [driverLocation]);
384
-
385
- return (
386
- <OrderDetailsContainer keyboardShouldPersistTaps="handled">
387
- <Spinner visible={!order || Object.keys(order).length === 0} />
388
- {order && Object.keys(order).length > 0 && (
389
- <>
390
- <Header>
391
- <OButton
392
- imgLeftSrc={theme.images.general.arrow_left}
393
- imgRightSrc={null}
394
- style={styles.btnBackArrow}
395
- onClick={() => handleArrowBack()}
396
- imgLeftStyle={{ tintColor: theme.colors.disabled, width: 20 }}
397
- />
398
- <OrderInfo>
399
- <OrderData>
400
- <OText
401
- size={20}
402
- lineHeight={30}
403
- weight={'600'}
404
- color={theme.colors.textNormal}>
405
- {t('ORDER', 'Order')} #{order?.id}
406
- </OText>
407
- <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
408
- {order?.delivery_datetime_utc
409
- ? parseDate(order?.delivery_datetime_utc)
410
- : parseDate(order?.delivery_datetime, { utc: false })}
411
- </OText>
412
- <TouchableOpacity
413
- activeOpacity={0.7}
414
- style={{ marginTop: 6 }}
415
- onPress={() => { }}>
416
- <OText
417
- size={10}
418
- lineHeight={15}
419
- color={theme.colors.textSecondary}
420
- style={{ textDecorationLine: 'underline' }}>
421
- {t('REVIEW_ORDER', 'Review order')}
422
- </OText>
423
- </TouchableOpacity>
424
-
425
- <StaturBar>
426
- <LinearGradient
427
- start={{ x: 0.0, y: 0.0 }}
428
- end={{
429
- x: getOrderStatus(order?.status)?.percentage || 0,
430
- y: 0,
431
- }}
432
- locations={[0.9999, 0.9999]}
433
- colors={[theme.colors.primary, theme.colors.backgroundGray100]}
434
- style={styles.statusBar}
435
- />
436
- </StaturBar>
437
- <OText
438
- size={16}
439
- lineHeight={24}
440
- weight={'600'}
441
- color={theme.colors.textNormal}>
442
- {getOrderStatus(order?.status)?.value}
443
- </OText>
444
- </OrderData>
445
- <View
446
- style={{
447
- height: 8,
448
- backgroundColor: theme.colors.backgroundGray100,
449
- marginTop: 18,
450
- marginHorizontal: -40,
451
- }}
452
- />
453
- </OrderInfo>
454
- </Header>
455
- <OrderContent>
456
- <OrderBusiness>
457
- <OText
458
- size={16}
459
- lineHeight={24}
460
- weight={'500'}
461
- color={theme.colors.textNormal}
462
- mBottom={12}>
463
- {t('FROM', 'From')}
464
- </OText>
465
- <View
466
- style={{
467
- display: 'flex',
468
- flexDirection: 'column',
469
- alignItems: 'flex-start',
470
- }}>
471
- <View
472
- style={{
473
- flexDirection: 'row',
474
- alignItems: 'center',
475
- justifyContent: 'space-between',
476
- }}>
477
- <OText
478
- size={13}
479
- lineHeight={20}
480
- color={theme.colors.textNormal}
481
- style={{ flexGrow: 1, flexBasis: '80%' }}>
482
- {order?.business?.name}
483
- </OText>
484
- <Icons>
485
- <TouchableOpacity
486
- onPress={() =>
487
- props.navigation.navigate('Business', {
488
- store: businessData?.slug,
489
- })
490
- }
491
- style={{ paddingEnd: 5 }}>
492
- <OIcon
493
- src={theme.images.general.phone}
494
- width={16}
495
- color={theme.colors.disabled}
496
- />
497
- </TouchableOpacity>
498
- <TouchableOpacity
499
- style={{ paddingStart: 5 }}
500
- onPress={() => handleOpenMessagesForBusiness()}>
501
- <OIcon
502
- src={theme.images.general.chat}
503
- width={16}
504
- color={theme.colors.disabled}
505
- />
506
- </TouchableOpacity>
507
- </Icons>
508
- </View>
509
- <OText
510
- size={12}
511
- lineHeight={18}
512
- color={theme.colors.textNormal}
513
- mBottom={2}>
514
- {order?.business?.email}
515
- </OText>
516
- <OText
517
- size={12}
518
- lineHeight={18}
519
- color={theme.colors.textNormal}
520
- mBottom={2}>
521
- {order?.business?.cellphone}
522
- </OText>
523
- <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
524
- {order?.business?.address}
525
- </OText>
526
- </View>
527
- </OrderBusiness>
528
- <View
529
- style={{
530
- height: 8,
531
- backgroundColor: theme.colors.backgroundGray100,
532
- marginTop: 18,
533
- marginHorizontal: -40,
534
- }}
535
- />
536
- <OrderCustomer>
537
- <OText
538
- size={16}
539
- lineHeight={24}
540
- weight={'500'}
541
- color={theme.colors.textNormal}
542
- mBottom={12}>
543
- {t('TO', 'To')}
544
- </OText>
545
- <Customer>
546
- <InfoBlock>
547
- <OText
548
- size={12}
549
- lineHeight={18}
550
- color={theme.colors.textNormal}
551
- mBottom={2}>
552
- {order?.customer?.name} {order?.customer?.lastname}
553
- </OText>
554
- <OText
555
- size={12}
556
- lineHeight={18}
557
- color={theme.colors.textNormal}
558
- mBottom={2}>
559
- {order?.customer?.address}
560
- </OText>
561
- <OText
562
- size={12}
563
- lineHeight={18}
564
- color={theme.colors.textNormal}
565
- mBottom={2}>
566
- {order?.customer?.cellphone}
567
- </OText>
568
- </InfoBlock>
569
- </Customer>
570
- {order?.driver && (
571
- <>
572
- {order?.driver?.location && parseInt(order?.status) === 9 && (
573
- <Map>
574
- <GoogleMap
575
- location={order?.driver?.location}
576
- locations={locations}
577
- readOnly
578
- />
579
- </Map>
580
- )}
581
- </>
582
- )}
583
- </OrderCustomer>
584
- {order?.driver && (
585
- <>
586
- <View
587
- style={{
588
- height: 8,
589
- backgroundColor: theme.colors.backgroundGray100,
590
- marginTop: 18,
591
- marginHorizontal: -40,
592
- }}
593
- />
594
- <OrderDriver>
595
- <OText size={16} lineHeight={24} weight={'500'} style={{ marginBottom: 10 }}>{t('YOUR_DRIVER', 'Your Driver')}</OText>
596
- <Customer>
597
- <InfoBlock>
598
- <View
599
- style={{
600
- flexDirection: 'row',
601
- alignItems: 'center',
602
- justifyContent: 'space-between',
603
- }}>
604
- <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2} style={{ flexGrow: 1, flexBasis: '80%' }}>
605
- {order?.driver?.name} {order?.driver?.lastname}
606
- </OText>
607
- <Icons>
608
- <TouchableOpacity
609
- onPress={() => handleOpenMessagesForDriver()}>
610
- <OIcon
611
- src={theme.images.general.chat}
612
- width={16}
613
- color={theme.colors.disabled}
614
- />
615
- </TouchableOpacity>
616
- </Icons>
617
- </View>
618
- <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
619
- {order?.driver?.cellphone}
620
- </OText>
621
- </InfoBlock>
622
- </Customer>
623
- </OrderDriver>
624
- </>
625
- )}
626
- <View
627
- style={{
628
- height: 8,
629
- backgroundColor: theme.colors.backgroundGray100,
630
- marginTop: 18,
631
- marginHorizontal: -40,
632
- }}
633
- />
634
- <HeaderInfo>
635
- <OText
636
- size={24}
637
- color={theme.colors.textNormal}
638
- style={{ fontWeight: '600', marginBottom: 16 }}>
639
- {t(
640
- 'YOUR_ORDER_HAS_BEEN_RECEIVED',
641
- 'Your Order has been received',
642
- )}
643
- </OText>
644
- <OText color={theme.colors.textNormal} size={14} weight={'500'}>
645
- {t(
646
- 'ORDER_MESSAGE_HEADER_TEXT',
647
- 'Once business accepts your order, we will send you an email, thank you!',
648
- )}
649
- </OText>
650
- <OButton
651
- text={t('YOUR_ORDERS', 'Your Orders')}
652
- textStyle={{ fontSize: 14, color: theme.colors.primary }}
653
- imgRightSrc={null}
654
- borderColor={theme.colors.primary}
655
- bgColor={theme.colors.clear}
656
- style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
657
- parentStyle={{ marginTop: 29, width: '50%' }}
658
- onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
659
- />
660
- </HeaderInfo>
661
- <OrderProducts>
662
- {order?.products?.length &&
663
- order?.products.map((product: any, i: number) => (
664
- <ProductItemAccordion
665
- key={product?.id || i}
666
- product={product}
667
- isFromCheckout
668
- />
669
- ))}
670
- </OrderProducts>
671
- <OrderBill>
672
- <View style={{ height: 1, backgroundColor: theme.colors.border, marginBottom: 17 }} />
673
- <Table>
674
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL', 'Subtotal')}</OText>
675
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
676
- {parsePrice(((order?.summary?.subtotal || order?.subtotal) + getIncludedTaxes()))}
677
- </OText>
678
- </Table>
679
- {(order?.summary?.discount > 0 || order?.discount > 0) && (
680
- <Table>
681
- {order?.offer_type === 1 ? (
682
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
683
- {t('DISCOUNT', 'Discount')}
684
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(
685
- order?.offer_rate,
686
- parsePrice,
687
- )}%)`}</OText>
688
- </OText>
689
- ) : (
690
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DISCOUNT', 'Discount')}</OText>
691
- )}
692
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
693
- - {parsePrice(order?.summary?.discount || order?.discount)}
694
- </OText>
695
- </Table>
696
- )}
697
- {
698
- order?.taxes?.length === 0 && order?.tax_type === 2 && (
699
- <Table>
700
- <OText size={12}>
701
- {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
702
- </OText>
703
- <OText>{parsePrice(order?.summary?.tax || 0)}</OText>
704
- </Table>
705
- )
706
- }
707
- {
708
- order?.fees?.length === 0 && (
709
- <Table>
710
- <OText size={12}>
711
- {t('SERVICE_FEE', 'Service fee')}
712
- {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
713
- </OText>
714
- <OText>{parsePrice(order?.summary?.service_fee || 0)}</OText>
715
- </Table>
716
- )
717
- }
718
- {
719
- order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
720
- <Table key={tax.id}>
721
- <OSRow>
722
- <OText size={12} numberOfLines={1}>
723
- {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
724
- {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
725
- </OText>
726
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax })}>
727
- <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
728
- </TouchableOpacity>
729
- </OSRow>
730
- <OText size={12}>{parsePrice(tax?.summary?.tax || 0)}</OText>
731
- </Table>
732
- ))
733
- }
734
- {
735
- order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
736
- <Table key={fee.id}>
737
- <OSRow>
738
- <OText size={12} numberOfLines={1}>
739
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
740
- ({parsePrice(fee?.fixed)} + {fee.percentage}%){' '}
741
- </OText>
742
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })}>
743
- <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
744
- </TouchableOpacity>
745
- </OSRow>
746
- <OText size={12}>{parsePrice(fee?.fixed + fee?.summary?.percentage || 0)}</OText>
747
- </Table>
748
- ))
749
- }
750
- {(order?.summary?.delivery_price > 0 ||
751
- order?.deliveryFee > 0) && (
752
- <Table>
753
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
754
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
755
- {parsePrice(
756
- order?.summary?.delivery_price || order?.deliveryFee,
757
- )}
758
- </OText>
759
- </Table>
760
- )}
761
- <Table>
762
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
763
- {t('DRIVER_TIP', 'Driver tip')}
764
- {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) &&
765
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
766
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
767
- `(${verifyDecimals(order?.driver_tip, parseNumber)}%)`}
768
- </OText>
769
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
770
- {parsePrice(
771
- order?.summary?.driver_tip || order?.totalDriverTip,
772
- )}
773
- </OText>
774
- </Table>
775
-
776
- <Total>
777
- <Table>
778
- <OText size={20} lineHeight={30} weight={'600'} color={theme.colors.textNormal}>{t('TOTAL', 'Total')}</OText>
779
- <OText size={20} lineHeight={30} weight={'600'} color={theme.colors.textNormal}>
780
- {parsePrice(order?.summary?.total || order?.total)}
781
- </OText>
782
- </Table>
783
- </Total>
784
- {order?.comment && (
785
- <Table>
786
- <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
787
- <OText style={{ maxWidth: '70%' }}>
788
- {order?.comment}
789
- </OText>
790
- </Table>
791
- )}
792
- </OrderBill>
793
- </OrderContent>
794
- </>
795
- )}
796
- <OModal
797
- open={openModalForBusiness || openModalForDriver}
798
- customClose
799
- entireModal
800
- onClose={() => handleCloseModal()}>
801
- <Messages
802
- type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
803
- orderId={order?.id}
804
- messages={messages}
805
- order={order}
806
- setMessages={setMessages}
807
- onClose={() => handleCloseModal()}
808
- />
809
- </OModal>
810
- <OModal
811
- open={openTaxModal.open}
812
- onClose={() => setOpenTaxModal({ open: false, data: null })}
813
- entireModal
814
- >
815
- <TaxInformation data={openTaxModal.data} products={order?.products} />
816
- </OModal>
817
- </OrderDetailsContainer>
818
- );
819
- };
820
-
821
- export const OrderDetails = (props: OrderDetailsParams) => {
822
- const orderDetailsProps = {
823
- ...props,
824
- UIComponent: OrderDetailsUI,
825
- };
826
-
827
- return <OrderDetailsConTableoller {...orderDetailsProps} />;
828
- };