ordering-ui-react-native 0.15.68 → 0.15.69-release

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 (220) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +1 -1
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +16 -8
  8. package/src/components/BusinessInformation/index.tsx +14 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +23 -2
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +6 -2
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/NotificationSetting/index.tsx +85 -0
  17. package/src/components/OrderDetails/index.tsx +7 -21
  18. package/src/components/PaymentOptions/index.tsx +67 -50
  19. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  20. package/src/components/ReviewDriver/index.tsx +1 -1
  21. package/src/components/ReviewOrder/index.tsx +2 -1
  22. package/src/components/ReviewProducts/index.tsx +11 -0
  23. package/src/components/SignupForm/index.tsx +145 -61
  24. package/src/components/SingleProductCard/index.tsx +16 -4
  25. package/src/components/SingleProductReview/index.tsx +1 -1
  26. package/src/components/StripeMethodForm/index.tsx +22 -24
  27. package/src/components/UpsellingProducts/index.tsx +1 -1
  28. package/src/components/UserProfileForm/index.tsx +63 -6
  29. package/src/components/UserProfileForm/styles.tsx +8 -0
  30. package/src/components/VerifyPhone/styles.tsx +1 -2
  31. package/src/components/shared/OBottomPopup.tsx +6 -2
  32. package/src/components/shared/OModal.tsx +1 -1
  33. package/src/hooks/useCountdownTimer.tsx +26 -0
  34. package/src/index.tsx +2 -0
  35. package/src/navigators/CheckoutNavigator.tsx +6 -0
  36. package/src/navigators/HomeNavigator.tsx +12 -0
  37. package/src/pages/BusinessesListing.tsx +7 -6
  38. package/src/pages/MultiCheckout.tsx +31 -0
  39. package/src/pages/MultiOrdersDetails.tsx +27 -0
  40. package/src/pages/OrderDetails.tsx +1 -1
  41. package/src/pages/ReviewDriver.tsx +2 -2
  42. package/src/pages/ReviewOrder.tsx +2 -2
  43. package/src/pages/Sessions.tsx +22 -0
  44. package/src/theme.json +0 -1
  45. package/src/types/index.tsx +18 -11
  46. package/src/utils/index.tsx +68 -2
  47. package/themes/business/index.tsx +4 -0
  48. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  49. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  50. package/themes/business/src/components/Chat/index.tsx +51 -91
  51. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  52. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  53. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  54. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  55. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  56. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  57. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  58. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  59. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  60. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
  61. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  62. package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
  63. package/themes/business/src/components/OrdersOption/index.tsx +16 -4
  64. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  65. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  66. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  67. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  68. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  69. package/themes/business/src/components/shared/OModal.tsx +41 -38
  70. package/themes/business/src/types/index.tsx +14 -7
  71. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  72. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  73. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  74. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  75. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  76. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  77. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  78. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  79. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  80. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  81. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  82. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  83. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  84. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  85. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  86. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  87. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  88. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  89. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  90. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  91. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  92. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  93. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  94. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  95. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  96. package/themes/kiosk/src/types/index.d.ts +1 -0
  97. package/themes/original/index.tsx +24 -0
  98. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  99. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  100. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  101. package/themes/original/src/components/AddressList/index.tsx +30 -18
  102. package/themes/original/src/components/AppleLogin/index.tsx +6 -8
  103. package/themes/original/src/components/BusinessBasicInformation/index.tsx +304 -158
  104. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  105. package/themes/original/src/components/BusinessController/index.tsx +201 -96
  106. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  107. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  108. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  109. package/themes/original/src/components/BusinessListingSearch/index.tsx +231 -63
  110. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  111. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  112. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  113. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  114. package/themes/original/src/components/BusinessProductsList/index.tsx +70 -52
  115. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  116. package/themes/original/src/components/BusinessProductsListing/index.tsx +323 -155
  117. package/themes/original/src/components/BusinessProductsListing/styles.tsx +33 -0
  118. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  119. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
  120. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  121. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
  122. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  123. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +679 -0
  124. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  125. package/themes/original/src/components/BusinessesListing/index.tsx +104 -458
  126. package/themes/original/src/components/Cart/index.tsx +93 -43
  127. package/themes/original/src/components/Cart/styles.tsx +4 -0
  128. package/themes/original/src/components/Checkout/index.tsx +90 -39
  129. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  130. package/themes/original/src/components/Favorite/index.tsx +92 -0
  131. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  132. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  133. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  134. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  135. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  136. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  137. package/themes/original/src/components/Help/index.tsx +21 -4
  138. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  139. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  140. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  141. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  142. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  143. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  144. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  145. package/themes/original/src/components/Messages/index.tsx +1 -1
  146. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  147. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  148. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  149. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  150. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  151. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  152. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  153. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  154. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  155. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  156. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  157. package/themes/original/src/components/NavBar/index.tsx +4 -4
  158. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  159. package/themes/original/src/components/OrderDetails/index.tsx +148 -63
  160. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  161. package/themes/original/src/components/OrderItAgain/index.tsx +72 -0
  162. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  163. package/themes/original/src/components/OrderSummary/index.tsx +6 -6
  164. package/themes/original/src/components/OrderTypeSelector/index.tsx +79 -35
  165. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  166. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  168. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  170. package/themes/original/src/components/OrdersOption/index.tsx +137 -38
  171. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  172. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  173. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  174. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  175. package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
  176. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  177. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  178. package/themes/original/src/components/ProductForm/index.tsx +718 -679
  179. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  180. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  181. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  182. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  183. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  184. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  185. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  186. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  187. package/themes/original/src/components/Promotions/index.tsx +151 -133
  188. package/themes/original/src/components/Promotions/styles.tsx +2 -1
  189. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  190. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  191. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  192. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  193. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  194. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  195. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  196. package/themes/original/src/components/Sessions/index.tsx +160 -0
  197. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  198. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  199. package/themes/original/src/components/SingleOrderCard/index.tsx +310 -0
  200. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  201. package/themes/original/src/components/SingleProductCard/index.tsx +214 -90
  202. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  203. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  204. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  205. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  206. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  207. package/themes/original/src/components/UserFormDetails/index.tsx +102 -66
  208. package/themes/original/src/components/UserProfile/index.tsx +10 -1
  209. package/themes/original/src/components/UserProfileForm/index.tsx +32 -25
  210. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  211. package/themes/original/src/components/Wallets/index.tsx +25 -12
  212. package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
  213. package/themes/original/src/components/shared/OButton.tsx +2 -0
  214. package/themes/original/src/components/shared/OInput.tsx +3 -2
  215. package/themes/original/src/components/shared/OModal.tsx +4 -2
  216. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  217. package/themes/original/src/types/index.tsx +203 -35
  218. package/themes/original/src/utils/index.tsx +94 -1
  219. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  220. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,372 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import {
3
+ useLanguage,
4
+ useEvent,
5
+ useUtils,
6
+ OrderDetails as OrderDetailsController
7
+ } from 'ordering-components/native'
8
+ import { View, StyleSheet, TouchableOpacity, Linking } from 'react-native'
9
+ import { useTheme } from 'styled-components/native'
10
+ import { OText, OButton, OIcon } from '../shared'
11
+ import LinearGradient from 'react-native-linear-gradient'
12
+
13
+ import {
14
+ SingleOrderContainer,
15
+ StaturBar,
16
+ Icons
17
+ } from './styles'
18
+
19
+ const SingleOrderCardUI = (props: any) => {
20
+ const {
21
+ navigation,
22
+ orderTypes,
23
+ readMessages,
24
+ messages,
25
+ setMessages,
26
+ handleGoToOrderDetails
27
+ } = props
28
+
29
+ const { order } = props.order
30
+ const theme = useTheme()
31
+ const [, t] = useLanguage()
32
+ const [{ parseDate, parsePrice }] = useUtils()
33
+
34
+ const styles = StyleSheet.create({
35
+ statusBar: {
36
+ height: 12,
37
+ }
38
+ })
39
+
40
+ const getOrderStatus = (s: string) => {
41
+ const status = parseInt(s);
42
+ const orderStatus = [
43
+ {
44
+ key: 0,
45
+ value: t('PENDING', 'Pending'),
46
+ slug: 'PENDING',
47
+ percentage: 0.25,
48
+ image: theme.images.order.status0,
49
+ },
50
+ {
51
+ key: 1,
52
+ value: t('COMPLETED', 'Completed'),
53
+ slug: 'COMPLETED',
54
+ percentage: 1,
55
+ image: theme.images.order.status1,
56
+ },
57
+ {
58
+ key: 2,
59
+ value: t('REJECTED', 'Rejected'),
60
+ slug: 'REJECTED',
61
+ percentage: 0,
62
+ image: theme.images.order.status2,
63
+ },
64
+ {
65
+ key: 3,
66
+ value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
67
+ slug: 'DRIVER_IN_BUSINESS',
68
+ percentage: 0.6,
69
+ image: theme.images.order.status3,
70
+ },
71
+ {
72
+ key: 4,
73
+ value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
74
+ slug: 'PREPARATION_COMPLETED',
75
+ percentage: 0.7,
76
+ image: theme.images.order.status4,
77
+ },
78
+ {
79
+ key: 5,
80
+ value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
81
+ slug: 'REJECTED_BY_BUSINESS',
82
+ percentage: 0,
83
+ image: theme.images.order.status5,
84
+ },
85
+ {
86
+ key: 6,
87
+ value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
88
+ slug: 'REJECTED_BY_DRIVER',
89
+ percentage: 0,
90
+ image: theme.images.order.status6,
91
+ },
92
+ {
93
+ key: 7,
94
+ value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
95
+ slug: 'ACCEPTED_BY_BUSINESS',
96
+ percentage: 0.35,
97
+ image: theme.images.order.status7,
98
+ },
99
+ {
100
+ key: 8,
101
+ value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
102
+ slug: 'ACCEPTED_BY_DRIVER',
103
+ percentage: 0.45,
104
+ image: theme.images.order.status8,
105
+ },
106
+ {
107
+ key: 9,
108
+ value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
109
+ slug: 'PICK_UP_COMPLETED_BY_DRIVER',
110
+ percentage: 0.8,
111
+ image: theme.images.order.status9,
112
+ },
113
+ {
114
+ key: 10,
115
+ value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
116
+ slug: 'PICK_UP_FAILED_BY_DRIVER',
117
+ percentage: 0,
118
+ image: theme.images.order.status10,
119
+ },
120
+ {
121
+ key: 11,
122
+ value: t(
123
+ 'DELIVERY_COMPLETED_BY_DRIVER',
124
+ 'Delivery completed by driver',
125
+ ),
126
+ slug: 'DELIVERY_COMPLETED_BY_DRIVER',
127
+ percentage: 1,
128
+ image: theme.images.order.status11,
129
+ },
130
+ {
131
+ key: 12,
132
+ value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
133
+ slug: 'DELIVERY_FAILED_BY_DRIVER',
134
+ percentage: 0,
135
+ image: theme.images.order.status12,
136
+ },
137
+ {
138
+ key: 13,
139
+ value: t('PREORDER', 'PreOrder'),
140
+ slug: 'PREORDER',
141
+ percentage: 0,
142
+ image: theme.images.order.status13,
143
+ },
144
+ {
145
+ key: 14,
146
+ value: t('ORDER_NOT_READY', 'Order not ready'),
147
+ slug: 'ORDER_NOT_READY',
148
+ percentage: 0,
149
+ image: theme.images.order.status13,
150
+ },
151
+ {
152
+ key: 15,
153
+ value: t(
154
+ 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
155
+ 'Order picked up completed by customer',
156
+ ),
157
+ slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
158
+ percentage: 100,
159
+ image: theme.images.order.status1,
160
+ },
161
+ {
162
+ key: 16,
163
+ value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
164
+ slug: 'CANCELLED_BY_CUSTOMER',
165
+ percentage: 0,
166
+ image: theme.images.order.status2,
167
+ },
168
+ {
169
+ key: 17,
170
+ value: t(
171
+ 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
172
+ 'Order not picked up by customer',
173
+ ),
174
+ slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
175
+ percentage: 0,
176
+ image: theme.images.order.status2,
177
+ },
178
+ {
179
+ key: 18,
180
+ value: t(
181
+ 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
182
+ 'Driver almost arrived to business',
183
+ ),
184
+ slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
185
+ percentage: 0.15,
186
+ image: theme.images.order.status3,
187
+ },
188
+ {
189
+ key: 19,
190
+ value: t(
191
+ 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
192
+ 'Driver almost arrived to customer',
193
+ ),
194
+ slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
195
+ percentage: 0.9,
196
+ image: theme.images.order.status11,
197
+ },
198
+ {
199
+ key: 20,
200
+ value: t(
201
+ 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
202
+ 'Customer almost arrived to business',
203
+ ),
204
+ slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
205
+ percentage: 90,
206
+ image: theme.images.order.status7,
207
+ },
208
+ {
209
+ key: 21,
210
+ value: t(
211
+ 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
212
+ 'Customer arrived to business',
213
+ ),
214
+ slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
215
+ percentage: 95,
216
+ image: theme.images.order.status7,
217
+ },
218
+ {
219
+ key: 22,
220
+ value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
221
+ slug: 'ORDER_LOOKING_FOR_DRIVER',
222
+ percentage: 35,
223
+ image: theme.images.order.status8
224
+ },
225
+ {
226
+ key: 23,
227
+ value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
228
+ slug: 'ORDER_DRIVER_ON_WAY',
229
+ percentage: 45,
230
+ image: theme.images.order.status8
231
+ }
232
+ ];
233
+
234
+ const objectStatus = orderStatus.find((o) => o.key === status);
235
+
236
+ return objectStatus && objectStatus;
237
+ };
238
+
239
+ const handleGoToMessages = (type: string) => {
240
+ readMessages && readMessages();
241
+ navigation.navigate(
242
+ 'MessageDetails',
243
+ {
244
+ type,
245
+ order,
246
+ messages,
247
+ setMessages,
248
+ orderId: order?.id,
249
+ business: type === 'business',
250
+ driver: type === 'driver',
251
+ onClose: () => navigation?.canGoBack()
252
+ ? navigation.goBack()
253
+ : navigation.navigate('BottomTab', { screen: 'MyOrders' }),
254
+ }
255
+ )
256
+ }
257
+
258
+ return (
259
+ <SingleOrderContainer>
260
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 35 }}>
261
+ <View style={{ flex: 1, marginRight: 10 }}>
262
+ <OText size={16} lineHeight={24} mBottom={5} weight={'500'} color={theme.colors.textNormal}>
263
+ {t('ORDER', 'Order')} #{order.id}
264
+ </OText>
265
+ <View style={{ flexDirection: 'row' }}>
266
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>{orderTypes?.find((type: any) => order?.delivery_type === type?.value)?.text}:</OText>
267
+ <View style={{ flex: 1 }}>
268
+ <OText mLeft={5} size={12} lineHeight={18} color={theme.colors.textNormal}>
269
+ {
270
+ order?.delivery_datetime_utc
271
+ ? parseDate(order?.delivery_datetime_utc)
272
+ : parseDate(order?.delivery_datetime, { utc: false })
273
+ }
274
+ </OText>
275
+ </View>
276
+ </View>
277
+ </View>
278
+ <OButton
279
+ onClick={() => handleGoToOrderDetails(order?.uuid)}
280
+ textStyle={{ color: theme.colors.primary, textAlign: 'center', fontSize: 14 }}
281
+ style={{ flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0, paddingLeft: 5, paddingRight: 5, height: 44 }}
282
+ text={t('ORDER_DETAILS', 'Order Details')}
283
+ bgColor={theme.colors.white}
284
+ borderColor={theme.colors.primary}
285
+ />
286
+ </View>
287
+ <OText size={16} lineHeight={24} mBottom={17} weight={'500'} color={theme.colors.textNormal}>
288
+ {t('FROM', 'From')}
289
+ </OText>
290
+ <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
291
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
292
+ {order?.business?.name}
293
+ </OText>
294
+ <Icons>
295
+ {!!order?.business?.cellphone && (
296
+ <TouchableOpacity
297
+ onPress={() => order?.business?.cellphone &&
298
+ Linking.openURL(`tel:${order?.business?.cellphone}`)
299
+ }
300
+ style={{ paddingEnd: 5 }}
301
+ >
302
+ <OIcon
303
+ src={theme.images.general.phone}
304
+ width={16}
305
+ color={theme.colors.disabled}
306
+ />
307
+ </TouchableOpacity>
308
+ )}
309
+ <TouchableOpacity
310
+ style={{ paddingStart: 5 }}
311
+ onPress={() => handleGoToMessages('business')}>
312
+ <OIcon
313
+ src={theme.images.general.chat}
314
+ width={16}
315
+ color={theme.colors.disabled}
316
+ />
317
+ </TouchableOpacity>
318
+ </Icons>
319
+ </View>
320
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
321
+ {order?.business?.email}
322
+ </OText>
323
+ {!!order?.business?.cellphone && (
324
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
325
+ {order?.business?.cellphone}
326
+ </OText>
327
+ )}
328
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
329
+ {order?.business?.address}
330
+ </OText>
331
+ <StaturBar>
332
+ <LinearGradient
333
+ start={{ x: 0.0, y: 0.0 }}
334
+ end={{
335
+ x: getOrderStatus(order?.status)?.percentage || 0,
336
+ y: 0,
337
+ }}
338
+ locations={[0.9999, 0.9999]}
339
+ colors={[theme.colors.primary, theme.colors.backgroundGray100]}
340
+ style={styles.statusBar}
341
+ />
342
+ </StaturBar>
343
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
344
+ {getOrderStatus(order?.status)?.value}
345
+ </OText>
346
+ <View style={{ flexDirection: 'row', justifyContent: 'flex-end', marginTop: 20 }}>
347
+ <OText size={16} lineHeight={24} weight={'600'} color={theme.colors.textNormal}>
348
+ {t('EXPORT_ORDER_TOTAL', 'Order total')}: {parsePrice(order?.summary?.total ?? order?.total)}
349
+ </OText>
350
+ </View>
351
+ </SingleOrderContainer>
352
+ )
353
+ }
354
+
355
+ export const SingleOrderCard = (props: any) => {
356
+ const [, t] = useLanguage()
357
+ const orderDetailsProps = {
358
+ ...props,
359
+ orderTypes: props.orderTypes || [
360
+ { value: 1, text: t('DELIVERY', 'Delivery') },
361
+ { value: 2, text: t('PICKUP', 'Pickup') },
362
+ { value: 3, text: t('EAT_IN', 'Eat in') },
363
+ { value: 4, text: t('CURBSIDE', 'Curbside') },
364
+ { value: 5, text: t('DRIVE_THRU', 'Drive thru') }
365
+ ],
366
+ UIComponent: SingleOrderCardUI
367
+ }
368
+
369
+ return (
370
+ <OrderDetailsController {...orderDetailsProps} />
371
+ )
372
+ }
@@ -0,0 +1,258 @@
1
+ import React, { useEffect } from 'react'
2
+ import { useLanguage, useUtils, useToast, ToastType, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
3
+ import { View, StyleSheet, BackHandler } from 'react-native'
4
+ import { useTheme } from 'styled-components/native'
5
+ import { OText, OButton } from '../shared'
6
+ import { Container } from '../../layouts/Container'
7
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
8
+ import { SingleOrderCard } from './SingleOrderCard'
9
+
10
+ import {
11
+ OrdersDetailsContainer,
12
+ Header,
13
+ Divider,
14
+ Section,
15
+ Customer,
16
+ InfoBlock,
17
+ Row,
18
+ OrdersSummary,
19
+ BorderLine
20
+ } from './styles'
21
+
22
+ export const MultiOrdersDetailsUI = (props: any) => {
23
+ const {
24
+ navigation,
25
+ customer,
26
+ paymentEvents,
27
+ ordersSummary,
28
+ isFromMultiCheckout
29
+ } = props
30
+
31
+ const theme = useTheme()
32
+ const styles = StyleSheet.create({
33
+ btnBackArrow: {
34
+ borderWidth: 0,
35
+ backgroundColor: theme.colors.clear,
36
+ shadowColor: theme.colors.clear,
37
+ padding: 0,
38
+ marginLeft: -20
39
+ },
40
+ })
41
+
42
+ const { loading, orders, error } = props.ordersList
43
+ const [, t] = useLanguage()
44
+ const [{ parsePrice, parseNumber, parseDate }] = useUtils();
45
+ const [, { showToast }] = useToast();
46
+
47
+ const walletName: any = {
48
+ cash: {
49
+ name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
50
+ },
51
+ credit_point: {
52
+ name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet')
53
+ }
54
+ }
55
+
56
+ const handleArrowBack: any = () => {
57
+ if (!isFromMultiCheckout) {
58
+ navigation?.canGoBack() && navigation.goBack();
59
+ return;
60
+ }
61
+ navigation.navigate('BusinessList');
62
+ return true
63
+ }
64
+
65
+ const handleGoToOrderDetails = (uuid: any) => {
66
+ navigation.navigate('OrderDetails', { orderId: uuid })
67
+ }
68
+
69
+ useEffect(() => {
70
+ if (error) {
71
+ showToast(ToastType.Error, error)
72
+ }
73
+ }, [error])
74
+
75
+ useEffect(() => {
76
+ BackHandler.addEventListener('hardwareBackPress', handleArrowBack)
77
+ return () => {
78
+ BackHandler.removeEventListener('hardwareBackPress', handleArrowBack)
79
+ }
80
+ }, [])
81
+
82
+ return (
83
+ <OrdersDetailsContainer keyboardShouldPersistTaps="handled" contentContainerStyle={{ paddingHorizontal: 40 }}>
84
+ <View style={{ flexDirection: 'row' }}>
85
+ <OButton
86
+ imgLeftSrc={theme.images.general.arrow_left}
87
+ imgRightSrc={null}
88
+ style={styles.btnBackArrow}
89
+ onClick={() => handleArrowBack()}
90
+ imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
91
+ />
92
+ </View>
93
+ <Header>
94
+ {loading ? (
95
+ <Placeholder Animation={Fade}>
96
+ <PlaceholderLine
97
+ width={20}
98
+ height={30}
99
+ noMargin
100
+ style={{ borderRadius: 10, marginBottom: 8 }}
101
+ />
102
+ <PlaceholderLine
103
+ height={18}
104
+ noMargin
105
+ style={{ borderRadius: 10 }}
106
+ />
107
+ </Placeholder>
108
+ ) : (
109
+ <>
110
+ <OText size={20} lineHeight={30} mBottom={8} color={theme.colors.textNormal}>
111
+ {t('HEY', 'Hey')} <OText size={20} lineHeight={30} weight={700} mLeft={10} color={theme.colors.textNormal}>{customer?.name} {customer?.lastname}</OText>
112
+ </OText>
113
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>{t('ORDER_MESSAGE_HEADER_TEXT', 'Once business accepts your order, we will send you an email, thank you!')}</OText>
114
+ </>
115
+ )}
116
+ </Header>
117
+ <Divider />
118
+ <Section>
119
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={16}>
120
+ {t('CUSTOMER_DETAILS', 'Customer Details')}
121
+ </OText>
122
+ {loading ? (
123
+ <Customer>
124
+ <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
125
+ <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
126
+ <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
127
+ </Customer>
128
+ ) : (
129
+ <Customer>
130
+ <InfoBlock>
131
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
132
+ {customer?.name} {customer?.lastname}
133
+ </OText>
134
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
135
+ {customer?.address}
136
+ </OText>
137
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
138
+ {customer?.cellphone}
139
+ </OText>
140
+ </InfoBlock>
141
+ </Customer>
142
+ )}
143
+ </Section>
144
+ <Divider />
145
+ <Section>
146
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={16}>
147
+ {t('PAYMETHOD', 'Payment method')}
148
+ </OText>
149
+ {paymentEvents.map((event: any) => (
150
+ <OText key={event.id} size={12} lineHeight={18} color={theme.colors.textNormal}>
151
+ {event?.wallet_event
152
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
153
+ : event?.paymethod?.name}
154
+ </OText>
155
+ ))}
156
+ </Section>
157
+ <Divider />
158
+ <Section>
159
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
160
+ {t('DELIVERYA_V21', 'Delivery address')}
161
+ </OText>
162
+ {loading ? (
163
+ <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
164
+ ) : (
165
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
166
+ {customer?.address}
167
+ </OText>
168
+ )}
169
+ </Section>
170
+ <Divider />
171
+ {loading ? (
172
+ <Placeholder Animation={Fade}>
173
+ <PlaceholderLine
174
+ height={300}
175
+ noMargin
176
+ style={{ borderRadius: 10, marginBottom: 8 }}
177
+ />
178
+ </Placeholder>
179
+ ) : (
180
+ <OrdersSummary>
181
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
182
+ {t('ORDER_SUMMARY', 'Order summary')}
183
+ </OText>
184
+ {orders.map((order: any) => (
185
+ <Row key={order.id}>
186
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
187
+ {t('ORDER', 'Order')} #{order.id}
188
+ </OText>
189
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
190
+ {parsePrice(order?.summary?.total ?? order?.total)}
191
+ </OText>
192
+ </Row>
193
+ ))}
194
+ <BorderLine />
195
+ <Row>
196
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
197
+ {t('TOTAL_BEFORE_TAX', 'Total before tax')}:
198
+ </OText>
199
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
200
+ {parsePrice(ordersSummary?.subtotal)}
201
+ </OText>
202
+ </Row>
203
+ <Row>
204
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
205
+ {t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
206
+ </OText>
207
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
208
+ {parsePrice(ordersSummary?.tax)}
209
+ </OText>
210
+ </Row>
211
+ <BorderLine />
212
+ <Row style={{ marginTop: 10 }}>
213
+ <OText size={14} lineHeight={18} weight={'500'} color={theme.colors.textNormal}>
214
+ {t('PAYMENT_TOTAL', 'Payment total')}:
215
+ </OText>
216
+ <OText size={14} lineHeight={18} weight={'500'} color={theme.colors.textNormal}>
217
+ {parsePrice(ordersSummary?.total)}
218
+ </OText>
219
+ </Row>
220
+ </OrdersSummary>
221
+ )}
222
+
223
+ {loading ? (
224
+ [...Array(3).keys()].map(i => (
225
+ <Placeholder Animation={Fade} key={i}>
226
+ <PlaceholderLine
227
+ height={300}
228
+ noMargin
229
+ style={{ borderRadius: 10, marginBottom: 8 }}
230
+ />
231
+ </Placeholder>
232
+ ))
233
+ ) : (
234
+ <>
235
+ {orders.map((order: any) => (
236
+ <React.Fragment key={order.id}>
237
+ <SingleOrderCard
238
+ navigation={navigation}
239
+ order={order}
240
+ handleGoToOrderDetails={handleGoToOrderDetails}
241
+ />
242
+ <Divider />
243
+ </React.Fragment>
244
+ ))}
245
+ </>
246
+ )}
247
+ <Divider />
248
+ </OrdersDetailsContainer>
249
+ )
250
+ }
251
+
252
+ export const MultiOrdersDetails = (props: any) => {
253
+ const MultiOrdersDetails = {
254
+ ...props,
255
+ UIComponent: MultiOrdersDetailsUI
256
+ }
257
+ return <MultiOrdersDetailsController {...MultiOrdersDetails} />
258
+ }
@@ -0,0 +1,50 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const OrdersDetailsContainer = styled.ScrollView`
4
+ `
5
+ export const Header = styled.View`
6
+ padding: 10px 0 24px 0;
7
+ `
8
+ export const Divider = styled.View`
9
+ height: 8px;
10
+ background-color: ${(props: any) => props.theme.colors.backgroundGray100};
11
+ margin-horizontal: -40px;
12
+ `
13
+ export const Section = styled.View`
14
+ padding: 24px 0px;
15
+ `
16
+ export const Customer = styled.View`
17
+ flex-direction: row;
18
+ align-items: center;
19
+ `
20
+ export const InfoBlock = styled.View`
21
+ width: 100%;
22
+ `
23
+ export const Row = styled.View`
24
+ flex-direction: row;
25
+ justify-content: space-between;
26
+ flex: 1;
27
+ align-items: center;
28
+ padding-bottom: 10px;
29
+ `
30
+ export const OrdersSummary = styled.View`
31
+ background-color: ${(props: any) => props.theme.colors.backgroundGray100};
32
+ margin-horizontal: -40px;
33
+ padding: 25px 40px;
34
+ `
35
+ export const BorderLine = styled.View`
36
+ height: 1px;
37
+ background-color: ${(props: any) => props.theme.colors.backgroundGray200};
38
+ margin-vertical: 6px;
39
+ `
40
+ export const SingleOrderContainer = styled.View`
41
+ padding: 40px 0;
42
+ `
43
+ export const StaturBar = styled.View`
44
+ margin-top: 30px;
45
+ margin-bottom: 10px;
46
+ `
47
+ export const Icons = styled.View`
48
+ flex-direction: row;
49
+ align-items: center;
50
+ `