ordering-ui-react-native 0.16.48 → 0.16.49-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 (208) hide show
  1. package/package.json +6 -5
  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/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/Messages/index.tsx +2 -2
  13. package/src/components/NotificationSetting/index.tsx +85 -0
  14. package/src/components/OrdersOption/index.tsx +54 -56
  15. package/src/components/PaymentOptions/index.tsx +298 -345
  16. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  17. package/src/components/ReviewDriver/index.tsx +1 -1
  18. package/src/components/ReviewOrder/index.tsx +2 -2
  19. package/src/components/ReviewProducts/index.tsx +11 -0
  20. package/src/components/SingleProductReview/index.tsx +8 -5
  21. package/src/components/StripeElementsForm/index.tsx +25 -16
  22. package/src/components/VerifyPhone/styles.tsx +1 -2
  23. package/src/components/shared/OBottomPopup.tsx +6 -2
  24. package/src/components/shared/OToast.tsx +4 -4
  25. package/src/index.tsx +2 -0
  26. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  27. package/src/utils/index.tsx +2 -1
  28. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +259 -238
  29. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  30. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  31. package/themes/business/src/components/Chat/index.tsx +40 -32
  32. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  33. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  34. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  35. package/themes/business/src/components/MapView/index.tsx +12 -1
  36. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  37. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  38. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +40 -30
  39. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  40. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  41. package/themes/business/src/components/OrdersOption/index.tsx +76 -77
  42. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  43. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  45. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  46. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  47. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  49. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  50. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  51. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  52. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  53. package/themes/business/src/components/PreviousOrders/index.tsx +332 -244
  54. package/themes/business/src/components/PreviousOrders/styles.tsx +30 -2
  55. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  56. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  57. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  58. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  59. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  60. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  61. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  62. package/themes/business/src/components/shared/OLink.tsx +24 -12
  63. package/themes/business/src/components/shared/OText.tsx +3 -2
  64. package/themes/business/src/types/index.tsx +25 -11
  65. package/themes/business/src/utils/index.tsx +10 -0
  66. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  67. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  68. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  69. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  70. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  71. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  72. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  73. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  74. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  75. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  76. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  77. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  78. package/themes/kiosk/src/types/index.d.ts +2 -0
  79. package/themes/original/index.tsx +8 -0
  80. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  81. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  82. package/themes/original/src/components/AddressList/index.tsx +1 -1
  83. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  84. package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
  85. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  86. package/themes/original/src/components/BusinessController/index.tsx +231 -114
  87. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  88. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  89. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  90. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  91. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  92. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  93. package/themes/original/src/components/BusinessListingSearch/index.tsx +109 -139
  94. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  95. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  96. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  97. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -60
  98. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  99. package/themes/original/src/components/BusinessProductsListing/index.tsx +177 -80
  100. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  101. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  102. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +35 -23
  103. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +275 -120
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  106. package/themes/original/src/components/BusinessesListing/index.tsx +80 -25
  107. package/themes/original/src/components/Cart/index.tsx +82 -15
  108. package/themes/original/src/components/Cart/styles.tsx +4 -0
  109. package/themes/original/src/components/CartContent/index.tsx +22 -16
  110. package/themes/original/src/components/Checkout/index.tsx +114 -118
  111. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  112. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  113. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  114. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  115. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  116. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  117. package/themes/original/src/components/FloatingButton/index.tsx +13 -11
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  120. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  121. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  122. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  123. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  124. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  125. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  126. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  127. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  128. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  129. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  130. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  131. package/themes/original/src/components/Messages/index.tsx +35 -20
  132. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  133. package/themes/original/src/components/MultiCart/index.tsx +63 -0
  134. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  135. package/themes/original/src/components/MultiCheckout/index.tsx +10 -2
  136. package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
  137. package/themes/original/src/components/MyOrders/index.tsx +88 -22
  138. package/themes/original/src/components/NavBar/index.tsx +11 -5
  139. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  140. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  141. package/themes/original/src/components/Notifications/index.tsx +148 -0
  142. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  143. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  144. package/themes/original/src/components/OrderDetails/index.tsx +200 -39
  145. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  146. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  147. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  148. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  149. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  150. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  152. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  153. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  154. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  155. package/themes/original/src/components/OrdersOption/index.tsx +101 -56
  156. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  157. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  158. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  159. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  160. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  161. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  162. package/themes/original/src/components/ProductForm/index.tsx +639 -664
  163. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  164. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  165. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  166. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  167. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  168. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  169. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  170. package/themes/original/src/components/Promotions/index.tsx +232 -219
  171. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  172. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  173. package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
  174. package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
  175. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  176. package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
  177. package/themes/original/src/components/ReviewTrigger/styles.tsx +41 -0
  178. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  179. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  180. package/themes/original/src/components/ServiceForm/index.tsx +341 -267
  181. package/themes/original/src/components/SignupForm/index.tsx +160 -113
  182. package/themes/original/src/components/SingleOrderCard/index.tsx +266 -183
  183. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  184. package/themes/original/src/components/SingleProductCard/index.tsx +198 -112
  185. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  186. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  187. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  188. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  189. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  190. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  191. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  192. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  193. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  194. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  195. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  196. package/themes/original/src/components/Wallets/index.tsx +176 -164
  197. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  198. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  199. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  200. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  201. package/themes/original/src/components/shared/OButton.tsx +10 -3
  202. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  203. package/themes/original/src/components/shared/OInput.tsx +10 -1
  204. package/themes/original/src/layouts/Container.tsx +13 -9
  205. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  206. package/themes/original/src/types/index.tsx +86 -28
  207. package/themes/original/src/utils/index.tsx +103 -58
  208. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,18 +1,17 @@
1
1
  import React, { useState } from 'react';
2
- import moment from 'moment';
3
2
  import {
4
3
  SingleOrderCard as SingleOrderCardController,
5
4
  useUtils,
5
+ useOrder,
6
6
  useLanguage
7
7
  } from 'ordering-components/native';
8
8
  import { StyleSheet, TouchableOpacity, View } from 'react-native';
9
9
  import { useTheme } from 'styled-components/native';
10
10
  import { OIcon, OText, OButton } from '../shared';
11
- import IconAntDesign from 'react-native-vector-icons/AntDesign'
12
11
  import { SingleOrderCardParams } from '../../types';
12
+ import { OAlert } from '../../../../../src/components/shared'
13
13
 
14
14
  import {
15
- Container,
16
15
  InnerContainer,
17
16
  Logo,
18
17
  CardInfoWrapper,
@@ -20,8 +19,11 @@ import {
20
19
  ButtonWrapper,
21
20
  ContentFooter,
22
21
  UnreadMessageCounter,
23
- Price
22
+ Price,
23
+ MultiLogosContainer
24
24
  } from './styles';
25
+ import { LottieAnimation } from '../LottieAnimation';
26
+ import { CardAnimation } from '../shared/CardAnimation';
25
27
 
26
28
  const SingleOrderCardUI = (props: SingleOrderCardParams) => {
27
29
  const {
@@ -33,23 +35,38 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
33
35
  onNavigationRedirect,
34
36
  pastOrders,
35
37
  isMessageView,
36
- handleClickOrder
38
+ handleClickOrder,
39
+ handleRemoveCart,
40
+ cartState
37
41
  } = props;
38
42
 
39
- const [{ parsePrice, optimizeImage }] = useUtils();
43
+ const [{ parsePrice, optimizeImage, parseDate }] = useUtils();
40
44
  const [, t] = useLanguage();
41
- const theme = useTheme();
45
+ const [{ carts }] = useOrder()
46
+ const theme = useTheme();
42
47
 
43
- const [reorderSelected, setReorderSelected] = useState<number | null>(null);
48
+ const [reorderSelected, setReorderSelected] = useState<number | null>(null);
49
+ const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
50
+ const [isPressed, setIsPressed] = useState(false)
44
51
 
45
- const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
52
+ const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
46
53
 
47
54
  const styles = StyleSheet.create({
48
- logo: {
49
- borderRadius: 8,
50
- width: 64,
51
- height: 64
52
- },
55
+ container: {
56
+ borderRadius: 7.6,
57
+ marginBottom: 10,
58
+ paddingVertical: 5,
59
+ },
60
+ logo: {
61
+ borderRadius: 8,
62
+ width: 64,
63
+ height: 64
64
+ },
65
+ minilogo: {
66
+ borderRadius: 8,
67
+ width: 40,
68
+ height: 40
69
+ },
53
70
  logoWrapper: {
54
71
  overflow: 'hidden',
55
72
  backgroundColor: 'white',
@@ -62,214 +79,280 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
62
79
  },
63
80
  buttonText: {
64
81
  color: theme.colors.primary,
65
- fontSize: 10,
66
- marginLeft: 2,
67
- marginRight: 2,
82
+ fontSize: 10,
83
+ marginLeft: 2,
84
+ marginRight: 2,
68
85
  },
69
86
  reorderLoading: {
70
87
  width: 80,
71
- height: 40,
72
- borderRadius: 10,
88
+ height: 40,
89
+ borderRadius: 10,
73
90
  },
74
91
  reorderbutton: {
75
- height: 23,
76
- paddingLeft: 10,
77
- paddingRight: 10,
78
- borderRadius: 23,
79
- shadowOpacity: 0,
80
- backgroundColor: theme.colors.primaryContrast,
81
- borderWidth: 0,
82
- },
92
+ height: 23,
93
+ paddingLeft: 10,
94
+ paddingRight: 10,
95
+ borderRadius: 23,
96
+ shadowOpacity: 0,
97
+ backgroundColor: theme.colors.primaryContrast,
98
+ borderWidth: 0,
99
+ },
83
100
  reviewButton: {
84
- height: 23,
85
- maxHeight: 23,
86
- backgroundColor: theme.colors.white,
87
- alignItems: 'center',
88
- justifyContent: 'center',
89
- paddingHorizontal: 10,
90
- borderRadius: 23,
91
- borderWidth: 1,
92
- borderColor: theme.colors.primaryContrast,
101
+ height: 23,
102
+ maxHeight: 23,
103
+ backgroundColor: theme.colors.white,
104
+ alignItems: 'center',
105
+ justifyContent: 'center',
106
+ paddingHorizontal: 10,
107
+ borderRadius: 23,
108
+ borderWidth: 1,
109
+ borderColor: theme.colors.primaryContrast,
93
110
  marginRight: 2
94
- },
111
+ },
95
112
  infoText: {
96
113
  flexDirection: 'row',
97
114
  alignItems: 'center'
115
+ },
116
+ cardAnimation: {
117
+ elevation: isPressed ? 2 : 0,
118
+ shadowColor: '#888',
119
+ shadowOffset: { width: 0, height: isPressed ? 2 : 0 },
120
+ shadowRadius: 18,
121
+ shadowOpacity: isPressed ? 0.8 : 0,
122
+ borderRadius: 12,
98
123
  }
99
- });
124
+ });
100
125
 
101
- const handleReorderClick = (id: number) => {
102
- setReorderSelected(id);
103
- handleReorder && handleReorder(id);
104
- };
126
+ const handleReorderClick = (order: any) => {
127
+ if (carts[`businessId:${order?.business_id}`] && carts[`businessId:${order?.business_id}`]?.products?.length > 0) {
128
+ setConfirm({
129
+ open: true,
130
+ content: [t('QUESTION_DELETE_PRODUCTS_FROM_CART', 'Are you sure that you want to delete all products from cart?')],
131
+ title: t('ORDER', 'Order'),
132
+ handleOnAccept: async () => {
133
+ handleRemoveCart()
134
+ setConfirm({ ...confirm, open: false })
135
+ }
136
+ })
137
+ } else {
138
+ setReorderSelected(order?.id);
139
+ handleReorder && handleReorder(order?.id);
140
+ }
141
+ };
105
142
 
106
143
  const handleClickOrderReview = (order: any) => {
107
144
  if (pastOrders) {
108
145
  onNavigationRedirect &&
109
- onNavigationRedirect('ReviewOrder', {
110
- order: {
111
- id: order?.id,
112
- business_id: order?.business_id,
113
- logo: order?.business?.logo,
114
- driver: order?.driver,
115
- products: order?.products,
116
- review: order?.review,
117
- user_review: order?.user_review
118
- },
119
- });
146
+ onNavigationRedirect('ReviewOrder', {
147
+ order: {
148
+ id: order?.id,
149
+ business_id: order?.business_id,
150
+ logo: order?.business?.length > 1 ? order?.business?.map?.((business : any) => business?.logo): order?.business?.logo,
151
+ driver: order?.driver,
152
+ products: order?.products,
153
+ review: order?.review,
154
+ user_review: order?.user_review,
155
+ business: order?.business
156
+ },
157
+ });
120
158
  return
121
159
  }
122
160
  if (isMessageView) {
123
- handleClickOrder(order?.uuid)
124
- return
125
- }
126
- onNavigationRedirect &&
127
- onNavigationRedirect('OrderDetails', { orderId: order?.uuid });
128
- };
129
-
130
- const handleClickViewOrder = (uuid: string) => {
131
- onNavigationRedirect &&
132
- onNavigationRedirect('OrderDetails', { orderId: uuid });
133
- };
161
+ handleClickOrder(order?.uuid)
162
+ return
163
+ }
164
+ onNavigationRedirect &&
165
+ onNavigationRedirect('OrderDetails', { orderId: order?.uuid });
166
+ };
134
167
 
135
- const formatDate = (date: string, option?: any) => {
136
- return option?.utc ? moment.utc(date).format('DD/MM/YY \u2022 h:m a') : moment(date).format('DD/MM/YY \u2022 h:m a');
137
- };
168
+ const handleClickViewOrder = (order: any) => {
169
+ if (isMessageView) {
170
+ handleClickOrder(order?.uuid)
171
+ return
172
+ }
173
+ if (order?.cart_group_id){
174
+ onNavigationRedirect?.('MultiOrdersDetails', { orderId: order?.cart_group_id });
175
+ } else {
176
+ onNavigationRedirect?.('OrderDetails', { orderId: order?.uuid });
177
+ }
178
+ };
138
179
 
139
180
  const handleChangeFavorite = () => {
140
181
  handleFavoriteOrder && handleFavoriteOrder(!order?.favorite)
141
182
  };
142
183
 
184
+ const handleOriginalReorder = () => {
185
+ setConfirm({ ...confirm, open: false, title: null })
186
+ setReorderSelected(order?.id);
187
+ handleReorder && handleReorder(order?.id);
188
+ }
189
+
143
190
  return (
144
- <Container
145
- onPress={() => handleClickViewOrder(order?.uuid)}
146
- activeOpacity={0.7}
147
- >
148
- <InnerContainer>
149
- {!!order.business?.logo && (
150
- <Logo style={styles.logoWrapper}>
151
- <OIcon
152
- url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
153
- style={styles.logo}
154
- />
155
- </Logo>
156
- )}
157
- <CardInfoWrapper>
158
- <ContentHeader>
159
- <View style={{ flex: 1 }}>
160
- <OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
161
- {order.business?.name}
162
- </OText>
163
- </View>
164
- {!!!pastOrders && (
165
- <>
166
- {isMessageView ? (
191
+ <>
192
+ <CardAnimation
193
+ onClick={() => handleClickViewOrder(order)}
194
+ style={[styles.container]}
195
+ >
196
+ <InnerContainer>
197
+ {(!!order.business?.logo || theme?.images?.dummies?.businessLogo) && (
198
+ <>
199
+ {order?.business?.length > 1 ? (
200
+ <MultiLogosContainer>
201
+ {order?.business?.map((business: any, i: number) => (
202
+ <View key={business?.id}>
203
+ {i > 1 ? (
204
+ <>
205
+ {console.log(order?.business?.length - 2)}
206
+ <OText mRight={3}> + {order?.business?.length - 2}</OText>
207
+ </>
208
+ ) : (
209
+ <Logo style={styles.logoWrapper} isMulti>
210
+ <OIcon
211
+ url={optimizeImage(business?.logo, 'h_300,c_limit')}
212
+ src={optimizeImage(!business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
213
+ style={styles.minilogo}
214
+ />
215
+ </Logo>
216
+ )}
217
+ </View>
218
+ ))}
219
+ </MultiLogosContainer>
220
+ ) : (
221
+ <Logo style={styles.logoWrapper}>
222
+ <OIcon
223
+ url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
224
+ src={optimizeImage(!order.business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
225
+ style={styles.logo}
226
+ />
227
+ </Logo>
228
+ )}
229
+ </>
230
+ )}
231
+ <CardInfoWrapper>
232
+ <ContentHeader>
233
+ <View style={{ flex: 1 }}>
234
+ <OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
235
+ {order?.business?.length > 1 ? `${t('GROUP_ORDER', 'Group Order')} ${t('No', 'No')}. ${order?.cart_group_id}` : order.business?.name}
236
+ </OText>
237
+ </View>
238
+ {!!!pastOrders && (
167
239
  <>
168
- {order?.unread_count > 0 && (
169
- <UnreadMessageCounter>
170
- <OText size={12} color={theme.colors.primary} lineHeight={18} >
171
- {order?.unread_count}
240
+ {isMessageView ? (
241
+ <>
242
+ {order?.unread_count > 0 && (
243
+ <UnreadMessageCounter>
244
+ <OText size={12} color={theme.colors.primary} lineHeight={18} >
245
+ {order?.unread_count}
246
+ </OText>
247
+ </UnreadMessageCounter>
248
+ )}
249
+ </>
250
+ ) : (
251
+ <Price>
252
+ <OText size={12} lineHeight={18}>
253
+ {parsePrice(order?.summary?.total || order?.total)}
172
254
  </OText>
173
- </UnreadMessageCounter>
255
+ </Price>
174
256
  )}
175
257
  </>
176
- ) : (
177
- <Price>
178
- <OText size={12} lineHeight={18}>
179
- {parsePrice(order?.summary?.total || order?.total)}
180
- </OText>
181
- </Price>
182
258
  )}
183
- </>
184
- )}
185
- {!!pastOrders && (
186
- <ButtonWrapper>
187
- {allowedOrderStatus.includes(parseInt(order?.status)) &&
188
- !order.review && (
189
- <TouchableOpacity
190
- onPress={() => handleClickOrderReview(order)}
191
- style={styles.reviewButton}>
192
- <OText size={10} color={theme.colors.primary} numberOfLines={1}>
193
- {t('REVIEW', 'Review')}
259
+ {!!pastOrders && (
260
+ <ButtonWrapper>
261
+ {allowedOrderStatus.includes(parseInt(order?.status)) &&
262
+ !order.review && (
263
+ <TouchableOpacity
264
+ onPress={() => handleClickOrderReview(order)}
265
+ style={styles.reviewButton}>
266
+ <OText size={10} color={theme.colors.primary} numberOfLines={1}>
267
+ {t('REVIEW', 'Review')}
268
+ </OText>
269
+ </TouchableOpacity>
270
+ )}
271
+ {order.cart && (
272
+ <OButton
273
+ text={t('REORDER', 'Reorder')}
274
+ imgRightSrc={''}
275
+ textStyle={styles.buttonText}
276
+ style={
277
+ ((reorderLoading && order.id === reorderSelected) || cartState?.loading)
278
+ ? styles.reorderLoading
279
+ : styles.reorderbutton
280
+ }
281
+ onClick={() => handleReorderClick(order)}
282
+ isLoading={(reorderLoading && order.id === reorderSelected) || cartState?.loading}
283
+ />
284
+ )}
285
+ </ButtonWrapper>
286
+ )}
287
+ </ContentHeader>
288
+ <ContentFooter>
289
+ <View style={{ flex: 1 }}>
290
+ <View style={styles.infoText}>
291
+ {(!!!pastOrders || order?.business?.length > 1) && (
292
+ <>
293
+ <OText
294
+ size={10}
295
+ space
296
+ color={theme.colors.textSecondary}
297
+ style={{ marginVertical: 3 }}
298
+ lineHeight={15}
299
+ numberOfLines={1}
300
+ >
301
+ {order?.business?.length > 1 ? order?.business?.length : (t('ORDER_NO', 'Order No') + '.')}
302
+ </OText>
303
+ <OText
304
+ size={10}
305
+ color={theme.colors.textSecondary}
306
+ style={{ marginVertical: 3 }}
307
+ lineHeight={15}
308
+ numberOfLines={1}
309
+ >
310
+ {order?.business?.length > 1 ? t('ORDERS', 'orders') + ' \u2022 ' : order.id + ` \u2022 `}
194
311
  </OText>
195
- </TouchableOpacity>
312
+ </>
196
313
  )}
197
- {order.cart && (
198
- <OButton
199
- text={t('REORDER', 'Reorder')}
200
- imgRightSrc={''}
201
- textStyle={styles.buttonText}
202
- style={
203
- reorderLoading && order.id === reorderSelected
204
- ? styles.reorderLoading
205
- : styles.reorderbutton
206
- }
207
- onClick={() => handleReorderClick(order.id)}
208
- isLoading={reorderLoading && order.id === reorderSelected}
209
- />
210
- )}
211
- </ButtonWrapper>
212
- )}
213
- </ContentHeader>
214
- <ContentFooter>
215
- <View style={{ flex: 1 }}>
216
- <View style={styles.infoText}>
217
- {!!!pastOrders && (
218
- <>
219
- <OText
220
- size={10}
221
- space
222
- color={theme.colors.textSecondary}
223
- style={{ marginVertical: 3 }}
224
- lineHeight={15}
225
- numberOfLines={1}
226
- >
227
- {t('ORDER_NO', 'Order No') + '.'}
228
- </OText>
229
- <OText
230
- size={10}
231
- color={theme.colors.textSecondary}
232
- style={{ marginVertical: 3 }}
233
- lineHeight={15}
234
- numberOfLines={1}
235
- >
236
- {order.id + ` \u2022 `}
237
- </OText>
238
- </>
239
- )}
314
+ <OText
315
+ size={10}
316
+ lineHeight={15}
317
+ color={theme.colors.textSecondary}
318
+ style={{ marginVertical: 3 }}
319
+ numberOfLines={1}>
320
+ {order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })}
321
+ </OText>
322
+ </View>
240
323
  <OText
324
+ color={theme.colors.primary}
241
325
  size={10}
242
326
  lineHeight={15}
243
- color={theme.colors.textSecondary}
244
- style={{ marginVertical: 3 }}
245
327
  numberOfLines={1}>
246
- {order?.delivery_datetime_utc
247
- ? formatDate(order?.delivery_datetime_utc)
248
- : formatDate(order?.delivery_datetime, { utc: false })}
328
+ {getOrderStatus(order.status)?.value}
249
329
  </OText>
250
330
  </View>
251
- <OText
252
- color={theme.colors.primary}
253
- size={10}
254
- lineHeight={15}
255
- numberOfLines={1}>
256
- {getOrderStatus(order.status)?.value}
257
- </OText>
258
- </View>
259
- <TouchableOpacity
260
- onPress={handleChangeFavorite}
261
- style={{ marginTop: 5 }}
262
- >
263
- <IconAntDesign
264
- name={order?.favorite ? 'heart' : 'hearto'}
265
- color={theme.colors.danger5}
266
- size={16}
267
- />
268
- </TouchableOpacity>
269
- </ContentFooter>
270
- </CardInfoWrapper>
271
- </InnerContainer>
272
- </Container>
331
+ {!isMessageView && !order?.business?.length && (
332
+ <LottieAnimation
333
+ type='favorite'
334
+ onClick={handleChangeFavorite}
335
+ initialValue={order?.favorite ? 0.75 : 0}
336
+ toValue={order?.favorite ? 0 : 0.75}
337
+ style={{ marginBottom: 5 }}
338
+ iconProps={{ color: theme.colors.danger5, size: 16, style: { top: 7 } }}
339
+ isActive={order?.favorite}
340
+ />
341
+ )}
342
+ </ContentFooter>
343
+ </CardInfoWrapper>
344
+ </InnerContainer>
345
+ </CardAnimation>
346
+ <OAlert
347
+ open={confirm.open}
348
+ title={confirm.title}
349
+ content={confirm.content}
350
+ onAccept={confirm.handleOnAccept}
351
+ onCancel={() => handleOriginalReorder()}
352
+ onClose={() => handleOriginalReorder()}
353
+ />
354
+ </>
355
+
273
356
  )
274
357
  }
275
358
 
@@ -1,11 +1,4 @@
1
- import styled from 'styled-components/native'
2
-
3
- export const Container = styled.TouchableOpacity`
4
- border-radius: 7.6px;
5
- box-shadow: 0 1px 2px #0000001A;
6
- margin-bottom: 10px;
7
- padding-vertical: 5px;
8
- `
1
+ import styled, { css } from 'styled-components/native'
9
2
 
10
3
  export const InnerContainer = styled.View`
11
4
  flex-direction: row;
@@ -15,6 +8,9 @@ export const InnerContainer = styled.View`
15
8
  export const Logo = styled.View`
16
9
  border-radius: 7.6px;
17
10
  margin-right: 12px;
11
+ ${({ isMulti } : any) => isMulti && css`
12
+ margin-right: 5px;
13
+ `}
18
14
  `
19
15
 
20
16
  export const CardInfoWrapper = styled.View`
@@ -52,3 +48,9 @@ export const Price = styled.View`
52
48
  margin-left: 10px;
53
49
  width: 30%;
54
50
  `
51
+
52
+ export const MultiLogosContainer = styled.View`
53
+ display: flex;
54
+ align-items: center;
55
+ flex-direction: row;
56
+ `