ordering-ui-react-native 0.16.13 → 0.16.14-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 (213) hide show
  1. package/package.json +7 -4
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  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 +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -0
  9. package/src/components/BusinessProductsList/index.tsx +10 -10
  10. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  11. package/src/components/BusinessesListing/index.tsx +1 -1
  12. package/src/components/Checkout/index.tsx +2 -1
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +118 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +143 -61
  26. package/src/components/SingleProductReview/index.tsx +8 -5
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/VerifyPhone/styles.tsx +1 -2
  29. package/src/components/shared/OBottomPopup.tsx +6 -2
  30. package/src/index.tsx +2 -0
  31. package/src/navigators/CheckoutNavigator.tsx +6 -0
  32. package/src/navigators/HomeNavigator.tsx +6 -0
  33. package/src/pages/BusinessesListing.tsx +7 -6
  34. package/src/pages/MultiCheckout.tsx +31 -0
  35. package/src/pages/MultiOrdersDetails.tsx +27 -0
  36. package/src/pages/OrderDetails.tsx +1 -1
  37. package/src/pages/ReviewDriver.tsx +2 -2
  38. package/src/pages/ReviewOrder.tsx +2 -2
  39. package/src/theme.json +0 -1
  40. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  41. package/src/types/index.tsx +13 -9
  42. package/src/utils/index.tsx +0 -1
  43. package/themes/business/index.tsx +4 -0
  44. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  45. package/themes/business/src/components/Chat/index.tsx +42 -34
  46. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  47. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  48. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  49. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  50. package/themes/business/src/components/MapView/index.tsx +1 -1
  51. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  52. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  53. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  54. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +19 -18
  55. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  56. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  57. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  58. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  59. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  61. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  62. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  63. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  65. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  66. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  67. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  68. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  69. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  70. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  71. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  72. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  73. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  74. package/themes/business/src/components/shared/OModal.tsx +40 -37
  75. package/themes/business/src/types/index.tsx +14 -9
  76. package/themes/business/src/utils/index.tsx +10 -0
  77. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  78. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  79. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  80. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  81. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  82. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  83. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  84. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  85. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  86. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  87. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  88. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  89. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  90. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  91. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  92. package/themes/kiosk/src/types/index.d.ts +2 -0
  93. package/themes/original/index.tsx +16 -0
  94. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  95. package/themes/original/src/components/AddressList/index.tsx +1 -1
  96. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  97. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  98. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  99. package/themes/original/src/components/BusinessController/index.tsx +173 -108
  100. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  101. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  102. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  103. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  104. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  105. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  106. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  107. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +1 -1
  108. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  109. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  110. package/themes/original/src/components/BusinessProductsList/index.tsx +53 -53
  111. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  112. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -181
  113. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  114. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  115. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  116. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  117. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  118. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  119. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  120. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  121. package/themes/original/src/components/BusinessesListing/index.tsx +100 -495
  122. package/themes/original/src/components/Cart/index.tsx +81 -36
  123. package/themes/original/src/components/Cart/styles.tsx +4 -0
  124. package/themes/original/src/components/CartContent/index.tsx +22 -16
  125. package/themes/original/src/components/Checkout/index.tsx +106 -66
  126. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  127. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  128. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  129. package/themes/original/src/components/Favorite/index.tsx +1 -0
  130. package/themes/original/src/components/Favorite/styles.tsx +1 -0
  131. package/themes/original/src/components/FavoriteList/index.tsx +143 -94
  132. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  133. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  134. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  135. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  136. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  137. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  138. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  139. package/themes/original/src/components/Messages/index.tsx +17 -17
  140. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  141. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  142. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  143. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  144. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  145. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  146. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  147. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  148. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  149. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  150. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  151. package/themes/original/src/components/NavBar/index.tsx +11 -5
  152. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  153. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  154. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  155. package/themes/original/src/components/OrderDetails/index.tsx +187 -49
  156. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  157. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  158. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  159. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  160. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  161. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  162. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  163. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  164. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  165. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  166. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  167. package/themes/original/src/components/OrdersOption/index.tsx +126 -37
  168. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  169. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  170. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  171. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  172. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  173. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  174. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  175. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  176. package/themes/original/src/components/ProductItemAccordion/index.tsx +170 -128
  177. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  178. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  179. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  180. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  181. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  182. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  183. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  184. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  185. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  186. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  187. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  188. package/themes/original/src/components/ServiceForm/index.tsx +631 -0
  189. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  190. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  191. package/themes/original/src/components/SingleOrderCard/index.tsx +213 -177
  192. package/themes/original/src/components/SingleProductCard/index.tsx +198 -110
  193. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  194. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  195. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  196. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  197. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  198. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  199. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  200. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  201. package/themes/original/src/components/UserProfile/index.tsx +8 -1
  202. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  203. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  204. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  205. package/themes/original/src/components/Wallets/index.tsx +174 -162
  206. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  207. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  208. package/themes/original/src/components/shared/OButton.tsx +10 -3
  209. package/themes/original/src/components/shared/OInput.tsx +3 -2
  210. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  211. package/themes/original/src/types/index.tsx +163 -47
  212. package/themes/original/src/utils/index.tsx +77 -0
  213. 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,262 @@
1
+ import React, { useEffect } from 'react'
2
+ import { useLanguage, useUtils, useToast, ToastType, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
3
+ import { View, StyleSheet, BackHandler, TouchableOpacity } 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
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
10
+
11
+ import {
12
+ OrdersDetailsContainer,
13
+ Header,
14
+ Divider,
15
+ Section,
16
+ Customer,
17
+ InfoBlock,
18
+ Row,
19
+ OrdersSummary,
20
+ BorderLine
21
+ } from './styles'
22
+
23
+ export const MultiOrdersDetailsUI = (props: any) => {
24
+ const {
25
+ navigation,
26
+ customer,
27
+ paymentEvents,
28
+ ordersSummary,
29
+ isFromMultiCheckout
30
+ } = props
31
+
32
+ const theme = useTheme()
33
+ const styles = StyleSheet.create({
34
+ btnBackArrow: {
35
+ borderWidth: 0,
36
+ backgroundColor: theme.colors.clear,
37
+ shadowColor: theme.colors.clear,
38
+ padding: 0,
39
+ marginLeft: -20
40
+ },
41
+ })
42
+
43
+ const { loading, orders, error } = props.ordersList
44
+ const [, t] = useLanguage()
45
+ const [{ parsePrice, parseNumber, parseDate }] = useUtils();
46
+ const [, { showToast }] = useToast();
47
+
48
+ const walletName: any = {
49
+ cash: {
50
+ name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
51
+ },
52
+ credit_point: {
53
+ name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet')
54
+ }
55
+ }
56
+
57
+ const handleArrowBack: any = () => {
58
+ if (!isFromMultiCheckout) {
59
+ navigation?.canGoBack() && navigation.goBack();
60
+ return;
61
+ }
62
+ navigation.navigate('BusinessList');
63
+ return true
64
+ }
65
+
66
+ const handleGoToOrderDetails = (uuid: any) => {
67
+ navigation.navigate('OrderDetails', { orderId: uuid })
68
+ }
69
+
70
+ useEffect(() => {
71
+ if (error) {
72
+ showToast(ToastType.Error, error)
73
+ }
74
+ }, [error])
75
+
76
+ useEffect(() => {
77
+ BackHandler.addEventListener('hardwareBackPress', handleArrowBack)
78
+ return () => {
79
+ BackHandler.removeEventListener('hardwareBackPress', handleArrowBack)
80
+ }
81
+ }, [])
82
+
83
+ return (
84
+ <OrdersDetailsContainer keyboardShouldPersistTaps="handled" contentContainerStyle={{ paddingHorizontal: 40 }}>
85
+ <View style={{ flexDirection: 'row' }}>
86
+ <OButton
87
+ imgRightSrc={null}
88
+ style={styles.btnBackArrow}
89
+ onClick={() => handleArrowBack()}
90
+ icon={AntDesignIcon}
91
+ iconProps={{
92
+ name: 'arrowleft',
93
+ size: 26
94
+ }}
95
+ />
96
+ </View>
97
+ <Header>
98
+ {loading ? (
99
+ <Placeholder Animation={Fade}>
100
+ <PlaceholderLine
101
+ width={20}
102
+ height={30}
103
+ noMargin
104
+ style={{ borderRadius: 10, marginBottom: 8 }}
105
+ />
106
+ <PlaceholderLine
107
+ height={18}
108
+ noMargin
109
+ style={{ borderRadius: 10 }}
110
+ />
111
+ </Placeholder>
112
+ ) : (
113
+ <>
114
+ <OText size={20} lineHeight={30} mBottom={8} color={theme.colors.textNormal}>
115
+ {t('HEY', 'Hey')} <OText size={20} lineHeight={30} weight={700} mLeft={10} color={theme.colors.textNormal}>{customer?.name} {customer?.lastname}</OText>
116
+ </OText>
117
+ <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>
118
+ </>
119
+ )}
120
+ </Header>
121
+ <Divider />
122
+ <Section>
123
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={16}>
124
+ {t('CUSTOMER_DETAILS', 'Customer Details')}
125
+ </OText>
126
+ {loading ? (
127
+ <Customer>
128
+ <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
129
+ <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
130
+ <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
131
+ </Customer>
132
+ ) : (
133
+ <Customer>
134
+ <InfoBlock>
135
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
136
+ {customer?.name} {customer?.lastname}
137
+ </OText>
138
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
139
+ {customer?.address}
140
+ </OText>
141
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
142
+ {customer?.cellphone}
143
+ </OText>
144
+ </InfoBlock>
145
+ </Customer>
146
+ )}
147
+ </Section>
148
+ <Divider />
149
+ <Section>
150
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={16}>
151
+ {t('PAYMETHOD', 'Payment method')}
152
+ </OText>
153
+ {paymentEvents.map((event: any) => (
154
+ <OText key={event.id} size={12} lineHeight={18} color={theme.colors.textNormal}>
155
+ {event?.wallet_event
156
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
157
+ : event?.paymethod?.name}
158
+ </OText>
159
+ ))}
160
+ </Section>
161
+ <Divider />
162
+ <Section>
163
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
164
+ {t('DELIVERYA_V21', 'Delivery address')}
165
+ </OText>
166
+ {loading ? (
167
+ <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
168
+ ) : (
169
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
170
+ {customer?.address}
171
+ </OText>
172
+ )}
173
+ </Section>
174
+ <Divider />
175
+ {loading ? (
176
+ <Placeholder Animation={Fade}>
177
+ <PlaceholderLine
178
+ height={300}
179
+ noMargin
180
+ style={{ borderRadius: 10, marginBottom: 8 }}
181
+ />
182
+ </Placeholder>
183
+ ) : (
184
+ <OrdersSummary>
185
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
186
+ {t('ORDER_SUMMARY', 'Order summary')}
187
+ </OText>
188
+ {orders.map((order: any) => (
189
+ <Row key={order.id}>
190
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
191
+ {t('ORDER', 'Order')} #{order.id}
192
+ </OText>
193
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
194
+ {parsePrice(order?.summary?.total ?? order?.total)}
195
+ </OText>
196
+ </Row>
197
+ ))}
198
+ <BorderLine />
199
+ <Row>
200
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
201
+ {t('TOTAL_BEFORE_TAX', 'Total before tax')}:
202
+ </OText>
203
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
204
+ {parsePrice(ordersSummary?.subtotal)}
205
+ </OText>
206
+ </Row>
207
+ <Row>
208
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
209
+ {t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
210
+ </OText>
211
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
212
+ {parsePrice(ordersSummary?.tax)}
213
+ </OText>
214
+ </Row>
215
+ <BorderLine />
216
+ <Row style={{ marginTop: 10 }}>
217
+ <OText size={14} lineHeight={18} weight={'500'} color={theme.colors.textNormal}>
218
+ {t('PAYMENT_TOTAL', 'Payment total')}:
219
+ </OText>
220
+ <OText size={14} lineHeight={18} weight={'500'} color={theme.colors.textNormal}>
221
+ {parsePrice(ordersSummary?.total)}
222
+ </OText>
223
+ </Row>
224
+ </OrdersSummary>
225
+ )}
226
+
227
+ {loading ? (
228
+ [...Array(3).keys()].map(i => (
229
+ <Placeholder Animation={Fade} key={i}>
230
+ <PlaceholderLine
231
+ height={300}
232
+ noMargin
233
+ style={{ borderRadius: 10, marginBottom: 8 }}
234
+ />
235
+ </Placeholder>
236
+ ))
237
+ ) : (
238
+ <>
239
+ {orders.map((order: any) => (
240
+ <React.Fragment key={order.id}>
241
+ <SingleOrderCard
242
+ navigation={navigation}
243
+ order={order}
244
+ handleGoToOrderDetails={handleGoToOrderDetails}
245
+ />
246
+ <Divider />
247
+ </React.Fragment>
248
+ ))}
249
+ </>
250
+ )}
251
+ <Divider />
252
+ </OrdersDetailsContainer>
253
+ )
254
+ }
255
+
256
+ export const MultiOrdersDetails = (props: any) => {
257
+ const MultiOrdersDetails = {
258
+ ...props,
259
+ UIComponent: MultiOrdersDetailsUI
260
+ }
261
+ return <MultiOrdersDetailsController {...MultiOrdersDetails} />
262
+ }
@@ -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
+ `