ordering-ui-react-native 0.17.69 → 0.17.70-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 (205) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +270 -245
  15. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  16. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  17. package/themes/business/src/components/Chat/index.tsx +124 -111
  18. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  19. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  22. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  23. package/themes/business/src/components/MapView/index.tsx +10 -10
  24. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  26. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  27. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +103 -39
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  32. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  33. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  34. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  35. package/themes/business/src/components/OrdersOption/index.tsx +21 -20
  36. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  37. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  38. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  39. package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
  40. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +2 -2
  41. package/themes/business/src/components/PreviousOrders/index.tsx +289 -217
  42. package/themes/business/src/components/PreviousOrders/styles.tsx +1 -1
  43. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  44. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  45. package/themes/business/src/components/StoresList/index.tsx +3 -4
  46. package/themes/business/src/components/UserProfileForm/index.tsx +11 -13
  47. package/themes/business/src/components/shared/OLink.tsx +11 -3
  48. package/themes/business/src/components/shared/OModal.tsx +16 -9
  49. package/themes/business/src/components/shared/OText.tsx +6 -1
  50. package/themes/business/src/types/index.tsx +30 -13
  51. package/themes/business/src/utils/index.tsx +29 -2
  52. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  54. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  56. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  57. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  58. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  59. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  60. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  61. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  62. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  63. package/themes/original/index.tsx +1 -1
  64. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  65. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  66. package/themes/original/src/components/AddressList/index.tsx +27 -22
  67. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  68. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  69. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  70. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  73. package/themes/original/src/components/BusinessController/index.tsx +80 -66
  74. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +139 -85
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  79. package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
  80. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  81. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  82. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  83. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  84. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  85. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  86. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -556
  87. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  88. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  89. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  92. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  93. package/themes/original/src/components/Cart/index.tsx +77 -79
  94. package/themes/original/src/components/CartContent/index.tsx +117 -20
  95. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  96. package/themes/original/src/components/Checkout/index.tsx +356 -124
  97. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  98. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  99. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  100. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  101. package/themes/original/src/components/Favorite/index.tsx +8 -9
  102. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  103. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  104. package/themes/original/src/components/FloatingButton/index.tsx +11 -14
  105. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  106. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  108. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  110. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  111. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  112. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  113. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  114. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  115. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  116. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  117. package/themes/original/src/components/Help/index.tsx +8 -8
  118. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  119. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  120. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  121. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  123. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  124. package/themes/original/src/components/Home/index.tsx +13 -4
  125. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  126. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  127. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  128. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  129. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  130. package/themes/original/src/components/Messages/index.tsx +14 -7
  131. package/themes/original/src/components/MomentOption/index.tsx +195 -90
  132. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  133. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  134. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  135. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  136. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  137. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  139. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  140. package/themes/original/src/components/MyOrders/index.tsx +40 -29
  141. package/themes/original/src/components/NavBar/index.tsx +20 -17
  142. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  143. package/themes/original/src/components/Notifications/index.tsx +46 -50
  144. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  145. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  146. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  147. package/themes/original/src/components/OrderDetails/index.tsx +191 -363
  148. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  149. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  150. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  151. package/themes/original/src/components/OrderSummary/index.tsx +88 -59
  152. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  153. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  154. package/themes/original/src/components/OrdersOption/index.tsx +68 -87
  155. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  156. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  157. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  158. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +78 -35
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  163. package/themes/original/src/components/ProductForm/index.tsx +105 -30
  164. package/themes/original/src/components/ProductForm/styles.tsx +5 -5
  165. package/themes/original/src/components/ProductItemAccordion/index.tsx +12 -9
  166. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  167. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  168. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  169. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  170. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  171. package/themes/original/src/components/Promotions/index.tsx +5 -4
  172. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  173. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  174. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  175. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  176. package/themes/original/src/components/Sessions/index.tsx +11 -8
  177. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  178. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  179. package/themes/original/src/components/SingleOrderCard/index.tsx +101 -62
  180. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  181. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  182. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  183. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  184. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  185. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  186. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  187. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  188. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  189. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  190. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  191. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  192. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  193. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  194. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  195. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  196. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  197. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  198. package/themes/original/src/components/Wallets/index.tsx +66 -30
  199. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  200. package/themes/original/src/components/shared/OButton.tsx +6 -2
  201. package/themes/original/src/components/shared/OInput.tsx +6 -1
  202. package/themes/original/src/components/shared/OModal.tsx +3 -3
  203. package/themes/original/src/types/index.tsx +42 -11
  204. package/themes/original/src/utils/index.tsx +273 -1
  205. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -3,11 +3,11 @@ import { View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useLanguage } from 'ordering-components/native';
5
5
 
6
- import {AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
6
+ import { AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
7
7
 
8
8
  import { OButton, OModal } from '../shared';
9
- import { OrderItem } from './OrderItem'
10
9
  import { OrdersGroupedItem } from './OrdersGroupedItem'
10
+ import { OrdersList } from './OrderList';
11
11
  import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
12
12
  import { ReviewCustomer } from '../ReviewCustomer';
13
13
  import { GoogleMap } from '../GoogleMap';
@@ -15,7 +15,6 @@ import { GoogleMap } from '../GoogleMap';
15
15
  export const PreviousOrders = (props: any) => {
16
16
  const {
17
17
  orders,
18
- ordersGrouped,
19
18
  onNavigationRedirect,
20
19
  getOrderStatus,
21
20
  handleClickOrder,
@@ -32,7 +31,7 @@ export const PreviousOrders = (props: any) => {
32
31
  const [, t] = useLanguage();
33
32
  const theme = useTheme();
34
33
 
35
- const [, setCurrentTime] = useState()
34
+ // const [, setCurrentTime] = useState()
36
35
  const [openModal, setOpenModal] = useState(false)
37
36
  const [openReviewModal, setOpenReviewModal] = useState({ order: null, ids: [], customerId: null })
38
37
  const [openMapViewModal, setOpenMapViewModal] = useState<any>({ open: false, customerLocation: null, locations: [] })
@@ -40,6 +39,8 @@ export const PreviousOrders = (props: any) => {
40
39
 
41
40
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
42
41
  const viewMapStatus = [9, 18, 19, 23]
42
+ const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
43
+ const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23]
43
44
 
44
45
  const handlePressOrder = (order: any) => {
45
46
  if (order?.locked && isLogisticOrder) return
@@ -47,78 +48,23 @@ export const PreviousOrders = (props: any) => {
47
48
  if (props.handleClickEvent) {
48
49
  props.handleClickEvent({ ...order, isLogistic: isLogisticOrder })
49
50
  } else {
50
- onNavigationRedirect &&
51
- onNavigationRedirect('OrderDetails', { order: { ...order, isLogistic: isLogisticOrder }, handleClickLogisticOrder });
51
+ if (isLogisticOrder) {
52
+ onNavigationRedirect &&
53
+ onNavigationRedirect('OrderDetailsLogistic', { order: { ...order, isLogistic: isLogisticOrder }, handleClickLogisticOrder });
54
+ } else {
55
+ onNavigationRedirect &&
56
+ onNavigationRedirect('OrderDetails', { order });
57
+ }
52
58
  }
53
59
  };
54
60
 
55
- const OrdersList = (props: any) => {
56
- const { order, _order, hideBtns } = props
57
- return (
58
- <View
59
- style={{
60
- backgroundColor: currentOrdenSelected === order?.id ? theme.colors.gray100 : order?.locked && isLogisticOrder ? '#ccc' : '#fff',
61
- marginBottom: isLogisticOrder ? 10 : 0
62
- }}
63
- >
64
- <OrderItem
65
- order={order}
66
- _order={_order}
67
- isLogisticOrder={isLogisticOrder}
68
- handlePressOrder={handlePressOrder}
69
- currentTabSelected={currentTabSelected}
70
- getOrderStatus={getOrderStatus}
71
- />
72
- {isLogisticOrder && !hideBtns && (
73
- <AcceptOrRejectOrderStyle>
74
- {!!order?.order_group_id && !!order?.order_group ? (
75
- <OButton
76
- text={t('VIEW_ORDER', 'View order')}
77
- onClick={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
78
- bgColor={theme.colors.blueLight}
79
- borderColor={theme.colors.blueLight}
80
- imgRightSrc={null}
81
- style={{ borderRadius: 7, height: 40 }}
82
- parentStyle={{ width: '100%' }}
83
- textStyle={{ color: theme.colors.primary }}
84
- />
85
- ) : (
86
- <>
87
- <OButton
88
- text={t('REJECT', 'Reject')}
89
- onClick={() => handleClickLogisticOrder(2, _order?.id)}
90
- bgColor={theme.colors.danger}
91
- borderColor={theme.colors.danger}
92
- imgRightSrc={null}
93
- style={{ borderRadius: 7, height: 40 }}
94
- parentStyle={{ width: '45%' }}
95
- textStyle={{ color: theme.colors.dangerText }}
96
- />
97
- <OButton
98
- text={t('ACCEPT', 'Accept')}
99
- onClick={() => handleClickLogisticOrder(1, _order?.id)}
100
- bgColor={theme.colors.successOrder}
101
- borderColor={theme.colors.successOrder}
102
- imgRightSrc={null}
103
- style={{ borderRadius: 7, height: 40 }}
104
- parentStyle={{ width: '45%' }}
105
- textStyle={{ color: theme.colors.successText }}
106
- />
107
- </>
108
- )}
109
- </AcceptOrRejectOrderStyle>
110
- )}
111
- </View>
112
- )
113
- }
114
-
115
61
  const ordersGroupAction = (param1 = '', param2 = '', { order, action, body, ids }: any = {}) => {
116
62
  setOrderUpdateStatus({ ...orderUpdateStatus, action, ids, body, order })
117
63
  if (!param1) setOpenModal(true)
118
64
  if (param1) {
119
65
  setOpenModal(false)
120
66
  handleChangeOrderStatus &&
121
- handleChangeOrderStatus(param1, orderUpdateStatus.ids, param2)
67
+ handleChangeOrderStatus(param1, orderUpdateStatus.ids, param2)
122
68
  }
123
69
  }
124
70
 
@@ -153,7 +99,7 @@ export const PreviousOrders = (props: any) => {
153
99
  if (_order?.customer?.location) {
154
100
  locations.push({
155
101
  ..._order?.customer?.location,
156
- title: _order?.customer?.name ?? t('CUSTOMER', 'Customer'),
102
+ title: _order?.customer?.name ?? t('CUSTOMER', 'Customer'),
157
103
  address: {
158
104
  addressName: _order?.customer?.address,
159
105
  zipcode: _order?.customer?.zipcode
@@ -174,165 +120,291 @@ export const PreviousOrders = (props: any) => {
174
120
  })
175
121
  }
176
122
 
177
- useEffect(() => {
178
- const interval = setInterval(() => {
179
- const date: any = Date.now()
180
- setCurrentTime(date)
181
- }, slaSettingTime ?? 6000)
123
+ // useEffect(() => {
124
+ // const interval = setInterval(() => {
125
+ // const date: any = Date.now()
126
+ // setCurrentTime(date)
127
+ // }, slaSettingTime ?? 6000)
182
128
 
183
- return () => clearInterval(interval)
184
- }, [])
129
+ // return () => clearInterval(interval)
130
+ // }, [])
185
131
 
186
132
 
187
133
  return (
188
134
  <>
189
- {ordersGrouped && Object.keys(ordersGrouped)?.length > 0 && (
190
- <View style={{ marginBottom: 10 }}>
191
- {Object.keys(ordersGrouped).map(k => (
192
- <OrdersGroupedItem
193
- key={k}
194
- groupId={k}
195
- orders={ordersGrouped[k]}
196
- >
197
- {ordersGrouped[k]?.length > 0 &&
198
- ordersGrouped[k]
199
- ?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
200
- ?.map((_order: any) => {
201
- const order = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
202
- return (
203
- <OrdersList key={order.id} order={order} _order={_order} hideBtns />
204
- )
135
+ {orders && orders?.length > 0 && orders.map((_order: any) => {
136
+ const order = !Array.isArray(_order) && (_order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order)
137
+ const _ordersGrouped = Array.isArray(_order) && Object.fromEntries(_order)
138
+ return (
139
+ _ordersGrouped ? (
140
+ <View key={_order[0]} style={{ marginBottom: 10 }}>
141
+ {Object.keys(_ordersGrouped).map((k, idx) => (
142
+ <OrdersGroupedItem
143
+ key={`${k}_${idx}`}
144
+ groupId={k}
145
+ orders={_ordersGrouped[k]}
146
+ >
147
+ {_ordersGrouped[k]?.length > 0 &&
148
+ _ordersGrouped[k]
149
+ ?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
150
+ ?.map((_order: any) => {
151
+ const order_ = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
152
+ return (
153
+ <OrdersList
154
+ key={order_.id}
155
+ order={order_}
156
+ _order={_order}
157
+ hideBtns
158
+ currentOrdenSelected={currentOrdenSelected}
159
+ isLogisticOrder={isLogisticOrder}
160
+ handlePressOrder={handlePressOrder}
161
+ currentTabSelected={currentTabSelected}
162
+ getOrderStatus={getOrderStatus}
163
+ handleClickLogisticOrder={handleClickLogisticOrder}
164
+ />
165
+ )
166
+ }
167
+ )
205
168
  }
206
- )
207
- }
208
- {ordersGrouped[k][0]?.status === 0 && (
209
- <AcceptOrRejectOrderStyle>
210
- <OButton
211
- text={t('REJECT_ALL', 'Reject all')}
212
- bgColor={theme.colors.danger100}
213
- borderColor={theme.colors.danger100}
214
- imgRightSrc={null}
215
- style={{ borderRadius: 7, height: 40 }}
216
- parentStyle={{ width: '45%' }}
217
- textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
218
- onClick={() => ordersGroupAction('', '', {
219
- action: 'reject',
220
- order: ordersGrouped[k][0],
221
- ids: ordersGrouped[k].map((o: any) => o.id)
222
- })}
223
- />
224
- <OButton
225
- text={t('ACCEPT_ALL', 'Accept all')}
226
- bgColor={theme.colors.success100}
227
- borderColor={theme.colors.success100}
228
- imgRightSrc={null}
229
- style={{ borderRadius: 7, height: 40 }}
230
- parentStyle={{ width: '45%' }}
231
- textStyle={{ color: theme.colors.success500, fontSize: 12 }}
232
- onClick={() => ordersGroupAction('', '', {
233
- action: 'accept',
234
- order: ordersGrouped[k][0],
235
- ids: ordersGrouped[k].map((o: any) => o.id)
236
- })}
237
- />
238
- </AcceptOrRejectOrderStyle>
239
- )}
240
- <View>
241
- {ordersGrouped[k][0]?.status === 7 && (
242
- <OButton
243
- text={t('READY_FOR_PICKUP', 'Ready for pickup')}
244
- bgColor={theme.colors.primaryLight}
245
- borderColor={theme.colors.primaryLight}
246
- imgRightSrc={null}
247
- style={{ borderRadius: 7, height: 40 }}
248
- parentStyle={{ width: '100%' }}
249
- textStyle={{ color: theme.colors.primary, fontSize: 12 }}
250
- onClick={() => handleChangeOrderStatus(
251
- 4,
252
- ordersGrouped[k].map((o: any) => o.id),
169
+ {_ordersGrouped[k][0]?.status === 0 && (
170
+ <AcceptOrRejectOrderStyle>
171
+ <OButton
172
+ text={t('REJECT_ALL', 'Reject all')}
173
+ bgColor={theme.colors.danger100}
174
+ borderColor={theme.colors.danger100}
175
+ imgRightSrc={null}
176
+ style={{ borderRadius: 7, height: 40 }}
177
+ parentStyle={{ width: '45%' }}
178
+ textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
179
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
180
+ action: 'reject',
181
+ order: _ordersGrouped[k][0],
182
+ ids: _ordersGrouped[k].map((o: any) => o.id),
183
+ handleChangeOrderStatus
184
+ })}
185
+ />
186
+ <OButton
187
+ text={t('ACCEPT_ALL', 'Accept all')}
188
+ bgColor={theme.colors.success100}
189
+ borderColor={theme.colors.success100}
190
+ imgRightSrc={null}
191
+ style={{ borderRadius: 7, height: 40 }}
192
+ parentStyle={{ width: '45%' }}
193
+ textStyle={{ color: theme.colors.success500, fontSize: 12 }}
194
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
195
+ action: 'accept',
196
+ order: _ordersGrouped[k][0],
197
+ ids: _ordersGrouped[k].map((o: any) => o.id),
198
+ handleChangeOrderStatus
199
+ })}
200
+ />
201
+ </AcceptOrRejectOrderStyle>
202
+ )}
203
+ {_ordersGrouped[k][0]?.status === 7 && (
204
+ <View>
205
+ <OButton
206
+ text={t('READY_FOR_PICKUP', 'Ready for pickup')}
207
+ bgColor={theme.colors.primaryLight}
208
+ borderColor={theme.colors.primaryLight}
209
+ imgRightSrc={null}
210
+ style={{ borderRadius: 7, height: 40 }}
211
+ parentStyle={{ width: '100%' }}
212
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
213
+ onClick={() => handleChangeOrderStatus(
214
+ 4,
215
+ _ordersGrouped[k].map((o: any) => o.id),
216
+ )}
217
+ />
218
+ </View>
219
+ )}
220
+ {(_ordersGrouped[k][0]?.status === 8 || _ordersGrouped[k][0]?.status === 18) &&
221
+ _ordersGrouped[k][0]?.delivery_type === 1 &&
222
+ (
223
+ <AcceptOrRejectOrderStyle>
224
+ <OButton
225
+ text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
226
+ bgColor={theme.colors.btnBGWhite}
227
+ borderColor={theme.colors.btnBGWhite}
228
+ imgRightSrc={null}
229
+ style={{ borderRadius: 7, height: 40 }}
230
+ parentStyle={{ width: '100%' }}
231
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
232
+ onClick={() => handleChangeOrderStatus(
233
+ 3,
234
+ _ordersGrouped[k].map((o: any) => o.id),
235
+ )}
236
+ />
237
+ </AcceptOrRejectOrderStyle>
238
+ )}
239
+ {_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 &&
240
+ (
241
+ <AcceptOrRejectOrderStyle>
242
+ <OButton
243
+ text={t('ORDER_NOT_READY', 'Order not ready')}
244
+ bgColor={theme.colors.red}
245
+ borderColor={theme.colors.red}
246
+ imgRightSrc={null}
247
+ style={{ borderRadius: 7, height: 40 }}
248
+ parentStyle={{ width: '100%' }}
249
+ textStyle={{ color: theme.colors.white, fontSize: 12 }}
250
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
251
+ action: 'notReady',
252
+ order: _ordersGrouped[k][0],
253
+ ids: _ordersGrouped[k].map((o: any) => o.id),
254
+ handleChangeOrderStatus
255
+ })}
256
+ />
257
+ </AcceptOrRejectOrderStyle>
258
+ )}
259
+ {viewMapStatus.includes(_ordersGrouped[k][0]?.status) &&
260
+ props.appTitle?.text?.includes('Business') &&
261
+ (
262
+ <View>
263
+ <OButton
264
+ text={t('TRACK_REAL_TIME_POSITION', 'Track real time position')}
265
+ bgColor={theme.colors.primaryLight}
266
+ borderColor={theme.colors.primaryLight}
267
+ imgRightSrc={null}
268
+ style={{ borderRadius: 7, height: 40 }}
269
+ parentStyle={{ width: '100%' }}
270
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
271
+ onClick={() => handleOpenMapView({ orders: _ordersGrouped[k] })}
272
+ />
273
+ </View>
253
274
  )}
254
- />
255
- )}
256
- </View>
257
- <View>
258
- {viewMapStatus.includes(ordersGrouped[k][0]?.status) && (
259
- <OButton
260
- text={t('TRACK_REAL_TIME_POSITION', 'Track real time position')}
261
- bgColor={theme.colors.primaryLight}
262
- borderColor={theme.colors.primaryLight}
263
- imgRightSrc={null}
264
- style={{ borderRadius: 7, height: 40 }}
265
- parentStyle={{ width: '100%' }}
266
- textStyle={{ color: theme.colors.primary, fontSize: 12 }}
267
- onClick={() => handleOpenMapView({ orders: ordersGrouped[k] })}
268
- />
269
- )}
270
- </View>
271
- {ordersGrouped[k][0]?.status === 4 &&
272
- ![1].includes(ordersGrouped[k][0]?.delivery_type) &&
273
- (
274
- <AcceptOrRejectOrderStyle>
275
- <OButton
276
- text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
277
- bgColor={theme.colors.danger100}
278
- borderColor={theme.colors.danger100}
279
- imgRightSrc={null}
280
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
281
- parentStyle={{ width: '45%' }}
282
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
283
- onClick={() => handleChangeOrderStatus(
284
- 17,
285
- ordersGrouped[k].map((o: any) => o.id),
275
+ {_ordersGrouped[k][0]?.status === 4 &&
276
+ ![1].includes(_ordersGrouped[k][0]?.delivery_type) &&
277
+ (
278
+ <AcceptOrRejectOrderStyle>
279
+ <OButton
280
+ text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
281
+ bgColor={theme.colors.danger100}
282
+ borderColor={theme.colors.danger100}
283
+ imgRightSrc={null}
284
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
285
+ parentStyle={{ width: '45%' }}
286
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
287
+ onClick={() => handleChangeOrderStatus(
288
+ 17,
289
+ _ordersGrouped[k].map((o: any) => o.id),
290
+ )}
291
+ />
292
+ <OButton
293
+ text={t('PICKUP_COMPLETED_BY_CUSTOMER', 'Pickup completed by customer')}
294
+ bgColor={theme.colors.success100}
295
+ borderColor={theme.colors.success100}
296
+ imgRightSrc={null}
297
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
298
+ parentStyle={{ width: '45%' }}
299
+ textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
300
+ onClick={() => handleChangeOrderStatus(
301
+ 15,
302
+ _ordersGrouped[k].map((o: any) => o.id),
303
+ )}
304
+ />
305
+ </AcceptOrRejectOrderStyle>
286
306
  )}
287
- />
288
- <OButton
289
- text={t('PICKUP_COMPLETED_BY_CUSTOMER', 'Pickup completed by customer')}
290
- bgColor={theme.colors.success100}
291
- borderColor={theme.colors.success100}
292
- imgRightSrc={null}
293
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
294
- parentStyle={{ width: '45%' }}
295
- textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
296
- onClick={() => handleChangeOrderStatus(
297
- 15,
298
- ordersGrouped[k].map((o: any) => o.id),
307
+ {!_ordersGrouped[k][0]?.user_review &&
308
+ pastOrderStatuses.includes(_ordersGrouped[k][0]?.status) &&
309
+ (
310
+ <OButton
311
+ text={t('REVIEW_CUSTOMER', 'Review customer')}
312
+ bgColor={theme.colors.primary}
313
+ borderColor={theme.colors.primary}
314
+ imgRightSrc={null}
315
+ style={{ borderRadius: 8, height: 40 }}
316
+ parentStyle={{ width: '100%' }}
317
+ textStyle={{ color: theme.colors.white }}
318
+ onClick={() => setOpenReviewModal({
319
+ order: _ordersGrouped[k][0],
320
+ customerId: _ordersGrouped[k][0]?.customer_id,
321
+ ids: _ordersGrouped[k].map((o: any) => o.id)
322
+ })}
323
+ />
299
324
  )}
300
- />
301
- </AcceptOrRejectOrderStyle>
302
- )}
303
- {!ordersGrouped[k][0]?.user_review &&
304
- pastOrderStatuses.includes(ordersGrouped[k][0]?.status) &&
305
- (
306
- <OButton
307
- text={t('REVIEW_CUSTOMER', 'Review customer')}
308
- bgColor={theme.colors.primary}
309
- borderColor={theme.colors.primary}
310
- imgRightSrc={null}
311
- style={{ borderRadius: 8, height: 40 }}
312
- parentStyle={{ width: '100%' }}
313
- textStyle={{ color: theme.colors.white }}
314
- onClick={() => setOpenReviewModal({
315
- order: ordersGrouped[k][0],
316
- customerId: ordersGrouped[k][0]?.customer_id,
317
- ids: ordersGrouped[k].map((o: any) => o.id)
318
- })}
319
- />
320
- )}
321
- </OrdersGroupedItem>
322
- ))}
323
- </View>
324
- )}
325
- {orders?.length > 0 &&
326
- orders
327
- ?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
328
- ?.map((_order: any) => {
329
- const order = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
330
- return (
331
- <OrdersList key={order.id} order={order} _order={_order} />
332
- )
333
- }
325
+ {!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && (
326
+ <AcceptOrRejectOrderStyle>
327
+ <OButton
328
+ text={t('PICKUP_FAILED', 'Pickup failed')}
329
+ bgColor={theme.colors.danger100}
330
+ borderColor={theme.colors.danger100}
331
+ imgRightSrc={null}
332
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
333
+ parentStyle={{ width: '45%' }}
334
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
335
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
336
+ action: 'pickupFailed',
337
+ order: _ordersGrouped[k][0],
338
+ ids: _ordersGrouped[k].map((o: any) => o.id),
339
+ handleChangeOrderStatus
340
+ })}
341
+ />
342
+ <OButton
343
+ text={t('PICKUP_COMPLETE', 'Pickup complete')}
344
+ bgColor={theme.colors.success100}
345
+ borderColor={theme.colors.success100}
346
+ imgRightSrc={null}
347
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
348
+ parentStyle={{ width: '45%' }}
349
+ textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
350
+ onClick={() => handleChangeOrderStatus(
351
+ 9,
352
+ _ordersGrouped[k].map((o: any) => o.id),
353
+ )}
354
+ />
355
+ </AcceptOrRejectOrderStyle>
356
+ )}
357
+ {!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) && (
358
+ <AcceptOrRejectOrderStyle>
359
+ <OButton
360
+ text={t('DELIVERY_FAILED', 'Delivery Failed')}
361
+ bgColor={theme.colors.danger100}
362
+ borderColor={theme.colors.danger100}
363
+ imgRightSrc={null}
364
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
365
+ parentStyle={{ width: '45%' }}
366
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
367
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
368
+ action: 'deliveryFailed',
369
+ order: _ordersGrouped[k][0],
370
+ ids: _ordersGrouped[k].map((o: any) => o.id),
371
+ handleChangeOrderStatus
372
+ })}
373
+ />
374
+ <OButton
375
+ text={t('DELIVERY_COMPLETE', 'Delivery complete')}
376
+ bgColor={theme.colors.success100}
377
+ borderColor={theme.colors.success100}
378
+ imgRightSrc={null}
379
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
380
+ parentStyle={{ width: '45%' }}
381
+ textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
382
+ onClick={() => handleChangeOrderStatus(
383
+ 11,
384
+ _ordersGrouped[k].map((o: any) => o.id),
385
+ )}
386
+ />
387
+ </AcceptOrRejectOrderStyle>
388
+ )}
389
+ </OrdersGroupedItem>
390
+ ))}
391
+ </View>
392
+ ) : (
393
+ <View key={order.id}>
394
+ <OrdersList
395
+ order={order}
396
+ _order={_order}
397
+ currentOrdenSelected={currentOrdenSelected}
398
+ isLogisticOrder={isLogisticOrder}
399
+ handlePressOrder={handlePressOrder}
400
+ currentTabSelected={currentTabSelected}
401
+ getOrderStatus={getOrderStatus}
402
+ handleClickLogisticOrder={handleClickLogisticOrder}
403
+ />
404
+ </View>
405
+ )
334
406
  )
335
- }
407
+ })}
336
408
 
337
409
  <OModal
338
410
  open={openModal}
@@ -33,7 +33,7 @@ export const NotificationIcon = styled.View`
33
33
  export const AcceptOrRejectOrder = styled.View`
34
34
  flex-direction: row;
35
35
  justify-content: space-between;
36
- margin: 10px;
36
+ margin: ${(props: any) => props.m ?? 10}px;
37
37
  `
38
38
  export const Timestatus = styled.View`
39
39
  position: relative;;
@@ -1,8 +1,12 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { View, Animated } from 'react-native';
1
+ import React, { useEffect, useState, useCallback } from 'react';
2
+ import { View, Animated, TouchableOpacity } from 'react-native';
3
3
  import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';
4
4
  import { useUtils, useLanguage } from 'ordering-components/native';
5
5
  import { useTheme } from 'styled-components/native';
6
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
7
+
8
+ const { useDeviceOrientation } = DeviceOrientationMethods
9
+
6
10
  import {
7
11
  Accordion,
8
12
  AccordionSection,
@@ -34,8 +38,12 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
34
38
  const [, t] = useLanguage();
35
39
  const theme = useTheme();
36
40
  const [{ parsePrice }] = useUtils();
41
+ const [orientationState] = useDeviceOrientation();
42
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
37
43
 
38
44
  const [isActive, setActiveState] = useState(false);
45
+ const [isReadMore, setIsReadMore] = useState(false);
46
+ const [lengthMore, setLengthMore] = useState(false);
39
47
 
40
48
  const productInfo = () => {
41
49
  if (isCartProduct) {
@@ -108,6 +116,10 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
108
116
  }
109
117
  }, []);
110
118
 
119
+ const onTextLayout = useCallback((e: any) => {
120
+ setLengthMore((e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2); //to check the text is more than 2 lines or not
121
+ },[]);
122
+
111
123
  return (
112
124
  <AccordionSection>
113
125
  <Accordion
@@ -288,9 +300,21 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
288
300
  color={theme.colors.unselectText}>
289
301
  {t('COMMENT', 'Comment')}
290
302
  </OText>
291
- <OText size={12} mLeft={10} color={theme.colors.unselectText}>
303
+ <OText
304
+ size={12}
305
+ style={{ width: '100%', paddingLeft: 10 }}
306
+ color={theme.colors.unselectText}
307
+ onTextLayout={onTextLayout}
308
+ numberOfLines={isReadMore ? 15 : 2}
309
+ ellipsizeMode="tail"
310
+ >
292
311
  {product.comment}
293
312
  </OText>
313
+ {lengthMore && (
314
+ <TouchableOpacity onPress={() => setIsReadMore(!isReadMore)} style={{ marginLeft: 10 }}>
315
+ <OText size={10} color={theme.colors.statusOrderBlue}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
316
+ </TouchableOpacity>
317
+ )}
294
318
  </ProductComment>
295
319
  )}
296
320
  </AccordionContent>