ordering-ui-react-native 0.17.71 → 0.17.72-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 (201) 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 +28 -24
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +149 -118
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  21. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +103 -39
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +17 -15
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +186 -114
  41. package/themes/business/src/components/PreviousOrders/styles.tsx +1 -1
  42. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  44. package/themes/business/src/components/StoresList/index.tsx +3 -4
  45. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  46. package/themes/business/src/components/shared/OLink.tsx +11 -3
  47. package/themes/business/src/components/shared/OModal.tsx +16 -9
  48. package/themes/business/src/components/shared/OText.tsx +6 -1
  49. package/themes/business/src/types/index.tsx +25 -10
  50. package/themes/business/src/utils/index.tsx +29 -2
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  55. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  56. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  57. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  58. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  60. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  61. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  62. package/themes/original/index.tsx +1 -1
  63. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  64. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  65. package/themes/original/src/components/AddressList/index.tsx +25 -24
  66. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  67. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  68. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  69. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  70. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  71. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  72. package/themes/original/src/components/BusinessController/index.tsx +80 -66
  73. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  74. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  75. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  76. package/themes/original/src/components/BusinessInformation/index.tsx +139 -85
  77. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  78. package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
  79. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  80. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  81. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  82. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  83. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  84. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  85. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -555
  86. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  90. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  91. package/themes/original/src/components/Cart/index.tsx +77 -79
  92. package/themes/original/src/components/CartContent/index.tsx +117 -20
  93. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  94. package/themes/original/src/components/Checkout/index.tsx +356 -124
  95. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  96. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  97. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  98. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  99. package/themes/original/src/components/Favorite/index.tsx +2 -6
  100. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  101. package/themes/original/src/components/FloatingButton/index.tsx +10 -13
  102. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  103. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  104. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  105. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  106. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  107. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  108. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  109. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  110. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  111. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  112. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  113. package/themes/original/src/components/Help/index.tsx +2 -2
  114. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  115. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  116. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  117. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  118. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  119. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  120. package/themes/original/src/components/Home/index.tsx +13 -4
  121. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  122. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  123. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  124. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  125. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  126. package/themes/original/src/components/Messages/index.tsx +14 -7
  127. package/themes/original/src/components/MomentOption/index.tsx +193 -90
  128. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  129. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  130. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  131. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  132. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  133. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  135. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  136. package/themes/original/src/components/MyOrders/index.tsx +40 -29
  137. package/themes/original/src/components/NavBar/index.tsx +20 -17
  138. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  139. package/themes/original/src/components/Notifications/index.tsx +42 -52
  140. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  141. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  142. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  143. package/themes/original/src/components/OrderDetails/index.tsx +191 -363
  144. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  146. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  147. package/themes/original/src/components/OrderSummary/index.tsx +88 -59
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  150. package/themes/original/src/components/OrdersOption/index.tsx +68 -87
  151. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  152. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  153. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  154. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  155. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  156. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  157. package/themes/original/src/components/PaymentOptions/index.tsx +78 -35
  158. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  159. package/themes/original/src/components/ProductForm/index.tsx +104 -29
  160. package/themes/original/src/components/ProductForm/styles.tsx +5 -5
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +12 -9
  162. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  163. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  164. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  165. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  166. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  167. package/themes/original/src/components/Promotions/index.tsx +2 -2
  168. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  169. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  170. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  171. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  172. package/themes/original/src/components/Sessions/index.tsx +11 -8
  173. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  174. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  175. package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
  176. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  177. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  178. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  179. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  180. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  182. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  183. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  184. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  185. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  186. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  187. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  188. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  189. package/themes/original/src/components/UserProfileForm/index.tsx +17 -21
  190. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  191. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  192. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  193. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  194. package/themes/original/src/components/Wallets/index.tsx +66 -30
  195. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  196. package/themes/original/src/components/shared/OButton.tsx +6 -2
  197. package/themes/original/src/components/shared/OInput.tsx +6 -1
  198. package/themes/original/src/components/shared/OModal.tsx +3 -3
  199. package/themes/original/src/types/index.tsx +41 -11
  200. package/themes/original/src/utils/index.tsx +273 -1
  201. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -154,6 +154,11 @@ export const transformCountryCode = (countryCode : number) => {
154
154
  return code?.countryCode
155
155
  }
156
156
 
157
+ export const verifyCountryCode = (countryCode : string) => {
158
+ const code = CODES.find((code : any) => code.countryCode === (countryCode || '').toUpperCase())
159
+ return code?.countryCode
160
+ }
161
+
157
162
  /**
158
163
  * Function to check if a number is decimal or not
159
164
  * @param {*} value number to check if decimal or not
@@ -41,6 +41,7 @@ import { MapViewUI as MapView } from './src/components/MapView'
41
41
  import { NewOrderNotification } from './src/components/NewOrderNotification';
42
42
  import { DriverSchedule } from './src/components/DriverSchedule';
43
43
  import { ScheduleBlocked } from './src/components/ScheduleBlocked';
44
+ import { OrderDetailsLogistic } from './src/components/OrderDetailsLogistic'
44
45
  //OComponents
45
46
  import {
46
47
  OText,
@@ -110,6 +111,7 @@ export {
110
111
  VerifyPhone,
111
112
  DriverSchedule,
112
113
  ScheduleBlocked,
114
+ OrderDetailsLogistic,
113
115
  //OComponents
114
116
  OAlert,
115
117
  OButton,
@@ -7,13 +7,14 @@ import {
7
7
  View,
8
8
  KeyboardAvoidingView,
9
9
  TextInput,
10
- StyleSheet
10
+ StyleSheet,
11
+ TouchableOpacity
11
12
  } from 'react-native';
12
13
  import { useTheme } from 'styled-components/native';
13
14
  import SelectDropdown from 'react-native-select-dropdown'
14
15
  import { useLanguage } from 'ordering-components/native';
15
16
  import { Content, Timer, TimeField, Header, Comments, CommentsButtonGroup, TopActions } from './styles';
16
- import { OText, OButton, OTextarea, OIconButton } from '../shared';
17
+ import { OText, OButton, OTextarea, OIcon } from '../shared';
17
18
  import { AcceptOrRejectOrderParams } from '../../types';
18
19
 
19
20
  import { orderCommentList } from '../../../../../src/utils'
@@ -95,7 +96,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
95
96
  upper: {
96
97
  flex: 1,
97
98
  zIndex: 1001,
98
- paddingTop: isPage ? 30 : 80,
99
+ paddingTop: isPage ? 30 : 40,
99
100
  marginBottom: 10,
100
101
  backgroundColor: theme.colors.backgroundPage
101
102
  },
@@ -109,7 +110,18 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
109
110
  bottom: {
110
111
  textAlignVertical: "center",
111
112
  textAlign: "center",
112
- }
113
+ },
114
+ btnBackArrow: {
115
+ borderWidth: 0,
116
+ width: 32,
117
+ height: 32,
118
+ tintColor: theme.colors.textGray,
119
+ backgroundColor: theme.colors.clear,
120
+ borderColor: theme.colors.clear,
121
+ shadowColor: theme.colors.clear,
122
+ paddingLeft: 0,
123
+ paddingRight: 0
124
+ },
113
125
  })
114
126
 
115
127
  const handleFocus = () => {
@@ -203,7 +215,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
203
215
  status: 7,
204
216
  },
205
217
  rejectByBusiness: {
206
- comment: comments,
218
+ reasons: comments,
207
219
  status: 5,
208
220
  },
209
221
  acceptByDriver: {
@@ -211,22 +223,22 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
211
223
  status: 8,
212
224
  },
213
225
  rejectByDriver: {
214
- comment: comments,
226
+ reasons: comments,
215
227
  status: 6,
216
228
  reject_reason: rejectReason
217
229
  },
218
230
  pickupFailedByDriver: {
219
- comment: comments,
231
+ reasons: comments,
220
232
  status: 10,
221
233
  reject_reason: rejectReason
222
234
  },
223
235
  deliveryFailedByDriver: {
224
- comment: comments,
236
+ reasons: comments,
225
237
  status: 12,
226
238
  reject_reason: rejectReason
227
239
  },
228
240
  orderNotReady: {
229
- comment: comments,
241
+ reasons: comments,
230
242
  status: 14,
231
243
  reject_reason: rejectReason
232
244
  },
@@ -299,18 +311,9 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
299
311
  <View style={styles.parent}>
300
312
  <View style={styles.upper}>
301
313
  <TopActions>
302
- <OIconButton
303
- icon={theme.images.general.arrow_left}
304
- borderColor={theme.colors.clear}
305
- iconStyle={{ width: 20, height: 20 }}
306
- style={{
307
- maxWidth: 40,
308
- height: 35,
309
- justifyContent: 'flex-end',
310
- marginBottom: 10,
311
- }}
312
- onClick={() => handleArrowBack()}
313
- />
314
+ <TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
315
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
316
+ </TouchableOpacity>
314
317
  <OText
315
318
  size={20}
316
319
  color={theme.colors.textGray}
@@ -339,7 +342,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
339
342
  )}
340
343
  </OText>
341
344
 
342
- {numberToShow ? (
345
+ {!!numberToShow ? (
343
346
  <OButton
344
347
  bgColor="transparent"
345
348
  borderColor={theme.colors.primary}
@@ -418,7 +421,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
418
421
  </Header>
419
422
 
420
423
  {action === 'accept' && (
421
- <View style={{ height: 400, justifyContent: 'center' }}>
424
+ <View style={{ height: 300, justifyContent: 'center' }}>
422
425
  <Timer onPress={() => openTimerIOnput()}>
423
426
  <OText weight="600" style={{ textAlign: 'center' }} size={55}>
424
427
  {hour}
@@ -518,7 +521,8 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
518
521
  imgRightSrc={null}
519
522
  style={{ borderRadius: 7, height: 45 }}
520
523
  parentStyle={{ width: '100%' }}
521
- textStyle={{color: '#FFF', fontSize: 18 }}
524
+ textStyle={{ color: '#FFF', fontSize: 18 }}
525
+ isDisabled={showTextArea && !comments}
522
526
  onClick={() => handleAcceptOrReject()}
523
527
  />
524
528
  </View>
@@ -97,7 +97,6 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
97
97
  <Logo style={styles.logo}>
98
98
  <OIcon
99
99
  url={optimizeImage(business?.logo, 'h_300,c_limit')}
100
- src={!business?.logo && theme?.images?.dummies?.businessLogo}
101
100
  style={styles.icon}
102
101
  />
103
102
  </Logo>
@@ -69,6 +69,8 @@ const ChatUI = (props: MessagesParams) => {
69
69
  const [, { showToast }] = useToast();
70
70
  const theme = useTheme();
71
71
  const [messageList, setMessageList] = useState<any>([])
72
+ const previousStatus = [1, 2, 5, 6, 10, 11, 12, 16, 17]
73
+ const chatDisabled = previousStatus.includes(order?.status)
72
74
 
73
75
  const ORDER_STATUS: any = {
74
76
  0: t('ORDER_STATUS_PENDING', 'Order status pending'),
@@ -97,6 +99,17 @@ const ChatUI = (props: MessagesParams) => {
97
99
  23: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
98
100
  }
99
101
 
102
+ const getLogisticTag = (status: any) => {
103
+ const keyList: any = {
104
+ 0: t('PENDING', 'Pending'),
105
+ 1: t('IN_PROGRESS', 'In progress'),
106
+ 2: t('IN_QUEUE', 'In queue'),
107
+ 3: t('EXPIRED', 'Expired'),
108
+ 4: t('RESOLVED', 'Resolved'),
109
+ }
110
+ return keyList[status] ? keyList[status] : t('UNKNOWN', 'Unknown')
111
+ }
112
+
100
113
  const storeMessageList: any = [
101
114
  { key: 'store_message_1', text: t('STORE_MESSAGE_1', 'store_message_1') },
102
115
  { key: 'store_message_2', text: t('STORE_MESSAGE_2', 'store_message_2') },
@@ -176,12 +189,8 @@ const ChatUI = (props: MessagesParams) => {
176
189
  fontSize: 12,
177
190
  },
178
191
  toolbarStyle: {
179
- flexDirection: 'column-reverse',
180
- paddingVertical: 15,
181
- paddingHorizontal: 30,
182
- backgroundColor: theme.colors.white,
183
- borderTopWidth: 1,
184
- borderTopColor: theme.colors.tabBar,
192
+ padding: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
193
+ flexDirection: 'column-reverse'
185
194
  },
186
195
  accessoryIcon: {
187
196
  height: 32,
@@ -314,14 +323,16 @@ const ChatUI = (props: MessagesParams) => {
314
323
  quality: 1
315
324
  },
316
325
  (response: any) => {
317
- if (response.didCancel) {
326
+ const image = response.assets?.[0];
327
+ if (!image) return
328
+ if (image.didCancel) {
318
329
  console.log('User cancelled image picker');
319
- } else if (response.errorMessage) {
320
- console.log('ImagePicker Error: ', response.errorMessage);
321
- showToast(ToastType.Error, response.errorMessage);
330
+ } else if (image.errorMessage) {
331
+ console.log('ImagePicker Error: ', image.errorMessage);
332
+ showToast(ToastType.Error, image.errorMessage);
322
333
  } else {
323
- if (response.uri) {
324
- const url = `data:${response.type};base64,${response.base64}`;
334
+ if (image.uri) {
335
+ const url = `data:${image.type};base64,${image.base64}`;
325
336
  setImage && setImage(url);
326
337
  } else {
327
338
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
@@ -372,18 +383,25 @@ const ChatUI = (props: MessagesParams) => {
372
383
  }}>
373
384
  <OText
374
385
  numberOfLines={3}
375
- style={{ ...styles.firstMessageText, textAlign: 'center' }}>
376
- {message.change?.attribute !== 'driver_id'
386
+ style={{ ...styles.firstMessageText, textAlign: 'center' }}
387
+ >
388
+ {
389
+ message.change?.attribute !== 'driver_id'
377
390
  ?
378
- `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
379
- `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
380
- `${message.change.old !== null && ORDER_STATUS[parseInt(message.change.old, 10)]} ${t('TO', 'to')} ${ORDER_STATUS[parseInt(message.change.new, 10)]}`
391
+ `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
392
+ ? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
393
+ : `${message.change?.attribute !== 'logistic_status'
394
+ ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
395
+ : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
396
+ ? t(ORDER_STATUS[parseInt(message.change.new, 10)])
397
+ : getLogisticTag(message.change.new)}`
381
398
  }`
382
399
  : message.change.new
383
400
  ?
384
401
  `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
385
402
  :
386
- `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`}
403
+ `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
404
+ }
387
405
  </OText>
388
406
  <OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
389
407
  {parseTime(message?.created_at, { outputFormat: 'hh:mma' })}
@@ -586,16 +604,12 @@ const ChatUI = (props: MessagesParams) => {
586
604
  };
587
605
 
588
606
  const renderAccessory = () => (
607
+ !chatDisabled &&
589
608
  <View>
590
609
  <Header
591
610
  showsVerticalScrollIndicator={false}
592
611
  showsHorizontalScrollIndicator={false}
593
612
  horizontal
594
- // contentContainerStyle={{
595
- // justifyContent:
596
- // orientation === 'Landscape' ? 'center' : 'space-between',
597
- // width: '100%',
598
- // }}
599
613
  nestedScrollEnabled={true}
600
614
  >
601
615
  {user?.level !== 2 && (
@@ -766,113 +780,130 @@ const ChatUI = (props: MessagesParams) => {
766
780
  containerStyle={styles.toolbarStyle}
767
781
  primaryStyle={{ alignItems: 'center', justifyContent: 'space-between' }}
768
782
  accessoryStyle={{ position: 'relative', marginBottom: 45 }}
769
- renderAccessory={order ? () => renderAccessory && renderAccessory() : undefined}
783
+ renderAccessory={() => renderAccessory()}
770
784
  />
771
785
  );
772
786
 
773
787
  const renderComposer = (props: any) => (
774
- <View
775
- style={{
776
- flexDirection: 'row',
777
- height: 44,
778
- width: '85%',
779
- backgroundColor: theme.colors.composerView,
780
- borderRadius: 7.6,
781
- alignItems: 'center',
782
- justifyContent: 'center',
783
- paddingRight: 10,
784
- }}>
785
- <Composer
786
- {...props}
787
- textInputStyle={{
788
- borderRadius: 7.6,
789
- borderColor: theme.colors.transparent,
790
- borderWidth: 0,
791
- color: '#010300',
792
- }}
793
- textInputProps={{
794
- value: message,
795
- onSubmitEditing: onSubmit,
796
- returnKeyType: message ? 'send' : 'done',
797
- blurOnSubmit: true,
798
- multiline: false,
799
- numberOfLines: 1,
800
- autoCorrect: false,
801
- autoCompleteType: 'off',
802
- enablesReturnKeyAutomatically: false,
803
- selectionColor: theme.colors.primary,
788
+ chatDisabled ? (
789
+ <View
790
+ style={{
791
+ width: '100%',
792
+ flexDirection: 'column',
793
+ alignItems: 'center'
804
794
  }}
805
- placeholder={t('WRITE_MESSAGE', 'Write message')}
806
- placeholderTextColor={theme.colors.composerPlaceHolder}
807
- />
808
-
809
- <TouchableOpacity
810
- onPress={() => {
811
- setImage && setImage(null);
812
- setIsShowSignaturePad(!isShowSignaturePad);
813
- }}>
795
+ >
814
796
  <MaterialCommunityIcon
815
- name="pen"
816
- color={
817
- isShowSignaturePad ? theme.colors.primary : theme.colors.arrowColor
818
- }
797
+ name='close-octagon-outline'
819
798
  size={24}
820
799
  />
821
- </TouchableOpacity>
822
-
823
- {!file.type && (
824
- <Actions
800
+ <OText size={14}>{t('NOT_SEND_MESSAGES', 'You can\'t send messages because the order has ended')}</OText>
801
+ </View>
802
+ ) : (
803
+ <View
804
+ style={{
805
+ flexDirection: 'row',
806
+ height: 44,
807
+ width: '85%',
808
+ backgroundColor: theme.colors.composerView,
809
+ borderRadius: 7.6,
810
+ alignItems: 'center',
811
+ justifyContent: 'center',
812
+ paddingRight: 10,
813
+ }}>
814
+ <Composer
825
815
  {...props}
826
- containerStyle={styles.containerActions}
827
- optionTintColor="#222845"
828
- icon={() => (
829
- <>
830
- {!file?.type && (
831
- <>
832
- <OIconButton
833
- borderColor={theme.colors.transparent}
834
- icon={
835
- !isShowSignaturePad && image
836
- ? { uri: image }
837
- : theme.images.general.imageChat
838
- }
839
- iconStyle={{
840
- borderRadius: image ? 10 : 0,
841
- width: image ? 32 : 28,
842
- height: image ? 32 : 28,
843
- }}
844
- onClick={handleImagePicker}
845
- iconCover
846
- />
847
-
848
- {image && !isShowSignaturePad && (
849
- <TouchableOpacity
850
- style={{
851
- position: 'absolute',
852
- top: -5,
853
- right: -5,
854
- borderColor: theme.colors.backgroundDark,
855
- backgroundColor: theme.colors.white,
856
- borderRadius: 25,
857
- }}
858
- onPress={() => removeImage()}>
859
- <MaterialCommunityIcon
860
- name="close-circle-outline"
861
- color={theme.colors.backgroundDark}
862
- size={24}
863
- />
864
- </TouchableOpacity>
865
- )}
866
- </>
867
- )}
868
- </>
869
- )}
816
+ textInputStyle={{
817
+ borderRadius: 7.6,
818
+ borderColor: theme.colors.transparent,
819
+ borderWidth: 0,
820
+ color: '#010300',
821
+ }}
822
+ textInputProps={{
823
+ value: message,
824
+ onSubmitEditing: onSubmit,
825
+ returnKeyType: message ? 'send' : 'done',
826
+ blurOnSubmit: true,
827
+ multiline: false,
828
+ numberOfLines: 1,
829
+ autoCorrect: false,
830
+ autoCompleteType: 'off',
831
+ enablesReturnKeyAutomatically: false,
832
+ selectionColor: theme.colors.primary,
833
+ }}
834
+ placeholder={t('WRITE_MESSAGE', 'Write message')}
835
+ placeholderTextColor={theme.colors.composerPlaceHolder}
870
836
  />
871
- )}
872
- </View>
837
+
838
+ <TouchableOpacity
839
+ onPress={() => {
840
+ setImage && setImage(null);
841
+ setIsShowSignaturePad(!isShowSignaturePad);
842
+ }}>
843
+ <MaterialCommunityIcon
844
+ name="pen"
845
+ color={
846
+ isShowSignaturePad ? theme.colors.primary : theme.colors.arrowColor
847
+ }
848
+ size={24}
849
+ />
850
+ </TouchableOpacity>
851
+
852
+ {!file.type && (
853
+ <Actions
854
+ {...props}
855
+ containerStyle={styles.containerActions}
856
+ optionTintColor="#222845"
857
+ icon={() => (
858
+ <>
859
+ {!file?.type && (
860
+ <>
861
+ <OIconButton
862
+ borderColor={theme.colors.transparent}
863
+ icon={
864
+ !isShowSignaturePad && image
865
+ ? { uri: image }
866
+ : theme.images.general.imageChat
867
+ }
868
+ iconStyle={{
869
+ borderRadius: image ? 10 : 0,
870
+ width: image ? 32 : 28,
871
+ height: image ? 32 : 28,
872
+ }}
873
+ onClick={handleImagePicker}
874
+ iconCover
875
+ />
876
+
877
+ {!!image && !isShowSignaturePad && (
878
+ <TouchableOpacity
879
+ style={{
880
+ position: 'absolute',
881
+ top: -5,
882
+ right: -5,
883
+ borderColor: theme.colors.backgroundDark,
884
+ backgroundColor: theme.colors.white,
885
+ borderRadius: 25,
886
+ }}
887
+ onPress={() => removeImage()}>
888
+ <MaterialCommunityIcon
889
+ name="close-circle-outline"
890
+ color={theme.colors.backgroundDark}
891
+ size={24}
892
+ />
893
+ </TouchableOpacity>
894
+ )}
895
+ </>
896
+ )}
897
+ </>
898
+ )}
899
+ />
900
+ )}
901
+ </View>
902
+ )
873
903
  );
874
904
 
875
905
  const renderSend = (props: any) => (
906
+ !chatDisabled &&
876
907
  <Send
877
908
  {...props}
878
909
  disabled={
@@ -1050,7 +1081,7 @@ const ChatUI = (props: MessagesParams) => {
1050
1081
  .m-signature-pad {
1051
1082
  box-shadow: none;
1052
1083
  border: none;
1053
- }
1084
+ }
1054
1085
  .m-signature-pad--body {
1055
1086
  border: none;
1056
1087
  }
@@ -12,7 +12,7 @@ import Icon from 'react-native-vector-icons/FontAwesome5';
12
12
  import { useTheme } from 'styled-components/native';
13
13
  import { useLocation } from '../../hooks/useLocation';
14
14
  import { FloatingButton } from '../FloatingButton';
15
- import { showLocation } from 'react-native-map-link';
15
+ import { Popup } from 'react-native-map-link';
16
16
  import { transformDistance } from '../../utils';
17
17
 
18
18
  export const DriverMap = (props: GoogleMapsParams) => {
@@ -48,6 +48,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
48
48
  const [distancesFromTwoPlacesKm, setDistancesFromTwoPlacesKm] = useState(0);
49
49
  const [isMin, setIsMin] = useState(false);
50
50
  const [{ parseDate }] = useUtils();
51
+ const [popUp, setPopUp] = useState<boolean>(false);
51
52
  const mapErrors: any = {
52
53
  ERROR_NOT_FOUND_ADDRESS: "Sorry, we couldn't find an address",
53
54
  ERROR_MAX_LIMIT_LOCATION_TO: 'Sorry, You can only set the position to',
@@ -452,7 +453,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
452
453
  {order?.delivery_datetime_utc
453
454
  ? parseDate(order?.delivery_datetime_utc)
454
455
  : parseDate(order?.delivery_datetime, { utc: false })}
455
- {` - ${order?.paymethod?.name}`}
456
+ {` - ${t(order?.paymethod?.name?.replace(/\s+/g, '_')?.toUpperCase(), order?.paymethod?.name)}`}
456
457
  </OText>
457
458
  <OText weight="bold">
458
459
  {t('INVOICE_ORDER_NO', 'Order No.')} {order?.id}
@@ -478,7 +479,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
478
479
  style={styles.arrowDistance}
479
480
  />
480
481
  <OText size={12} numberOfLines={3}>
481
- {`${transformDistance(distancesFromTwoPlacesKm, distanceUnit)} ${t(distanceUnit.toUpperCase(), distanceUnit)}`}
482
+ {`${transformDistance(distancesFromTwoPlacesKm, distanceUnit)} ${t(distanceUnit.toUpperCase(), distanceUnit)}`}
482
483
  </OText>
483
484
 
484
485
  </View>
@@ -501,7 +502,18 @@ export const DriverMap = (props: GoogleMapsParams) => {
501
502
  imgRightSrc=''
502
503
  textStyle={{ color: theme.colors.white }}
503
504
  style={styles.showButton}
504
- onClick={() => showLocation({
505
+ onClick={() => setPopUp(true)}
506
+ text={t('SHOW_IN_OTHER_MAPS', 'Show in other maps')}
507
+ />
508
+ <Popup
509
+ isVisible={popUp}
510
+ onCancelPressed={() => setPopUp(false)}
511
+ onAppPressed={() => setPopUp(false)}
512
+ onBackButtonPressed={() => setPopUp(false)}
513
+ modalProps={{
514
+ animationIn: 'slideInUp'
515
+ }}
516
+ options={{
505
517
  latitude: destination.latitude,
506
518
  longitude: destination.longitude,
507
519
  sourceLatitude: userLocation.latitude,
@@ -510,8 +522,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
510
522
  dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
511
523
  dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
512
524
  cancelText: t('CANCEL', 'Cancel'),
513
- })}
514
- text={t('SHOW_IN_OTHER_MAPS', 'Show in other maps')}
525
+ }}
515
526
  />
516
527
  </View>
517
528
  {showAcceptOrReject && (
@@ -1,7 +1,7 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { RefreshControl, ScrollView, View } from 'react-native'
3
3
  import { OText } from '../shared'
4
- import { useLanguage, useSession } from 'ordering-components/native'
4
+ import { useLanguage, useSession, useUtils } from 'ordering-components/native'
5
5
  import { DayContainer } from './styles'
6
6
  import { useTheme } from 'styled-components/native'
7
7
  export const DriverSchedule = (props: any) => {
@@ -9,7 +9,9 @@ export const DriverSchedule = (props: any) => {
9
9
  const [, t] = useLanguage()
10
10
  const theme = useTheme()
11
11
  const [, { refreshUserInfo }] = useSession()
12
+ const [{ parseDate }] = useUtils()
12
13
  const [refreshing] = useState(false);
14
+ const [driverSchedule, setDriverSchedule] = useState([]);
13
15
 
14
16
  const daysOfWeek = [
15
17
  t('SUNDAY_ABBREVIATION', 'Sun'),
@@ -21,11 +23,43 @@ export const DriverSchedule = (props: any) => {
21
23
  t('SATURDAY_ABBREVIATION', 'Sat')
22
24
  ]
23
25
 
26
+ const getNextDate = (day) => {
27
+ const now = new Date()
28
+ now.setDate(now.getDate() + (day + (7 - now.getDay())) % 7)
29
+ return now
30
+ }
31
+
24
32
  const scheduleFormatted = ({ hour, minute }: any) => {
25
33
  const checkTime = (val: number) => val < 10 ? `0${val}` : val
26
34
  return `${checkTime(hour)}:${checkTime(minute)}`
27
35
  }
28
36
 
37
+ useEffect(() => {
38
+ if (schedule) {
39
+ setDriverSchedule(schedule)
40
+ } else {
41
+ const _schedule: any = []
42
+ for (let i = 0; i < 7; i++) {
43
+ _schedule.push({
44
+ enabled: true,
45
+ lapses: [
46
+ {
47
+ open: {
48
+ hour: 0,
49
+ minute: 0
50
+ },
51
+ close: {
52
+ hour: 23,
53
+ minute: 59
54
+ }
55
+ }
56
+ ]
57
+ })
58
+ }
59
+ setDriverSchedule(_schedule)
60
+ }
61
+ }, [schedule])
62
+
29
63
  return (
30
64
  <ScrollView
31
65
  refreshControl={<RefreshControl
@@ -37,22 +71,25 @@ export const DriverSchedule = (props: any) => {
37
71
  {t('SCHEDULE', 'Schedule')}
38
72
  </OText>
39
73
  <View style={{ padding: 30 }}>
40
- {schedule.map((item: any, i: number) => (
74
+ {driverSchedule.map((item: any, i: number) => (
41
75
  <DayContainer key={daysOfWeek[i]}>
42
- <OText style={{ width: '20%' }} size={22} weight={700}>{daysOfWeek[i]}</OText>
43
- <View style={{ width: '80%', alignItems: 'center' }}>
76
+ <View style={{ flex: 1 }}>
77
+ <OText size={22} weight={700}>{daysOfWeek[i]}</OText>
78
+ <OText size={14}>{parseDate(getNextDate(i), { outputFormat: 'YYYY-MM-DD' })}</OText>
79
+ </View>
80
+ <View style={{ flex: 1 }}>
44
81
  <>
45
82
  {item?.enabled ? (
46
- <View>
83
+ <View style={{ width: '100%' }}>
47
84
  {item?.lapses.map((lapse: any, i: number) => (
48
85
  <View key={`${daysOfWeek[i]}_${i}`} style={{ marginTop: 3, marginBottom: 20, flexDirection: 'row', justifyContent: 'space-between' }}>
49
- <OText size={18} style={{ width: '30%' }}>
86
+ <OText size={18} style={{ flex: 1 }}>
50
87
  {scheduleFormatted(lapse.open)}
51
88
  </OText>
52
89
  <OText size={18} style={{ width: 15 }}>
53
90
  -
54
91
  </OText>
55
- <OText size={18} style={{ width: '30%' }}>
92
+ <OText size={18} style={{ flex: 1, textAlign: 'right' }}>
56
93
  {scheduleFormatted(lapse.close)}
57
94
  </OText>
58
95
  </View>