ordering-ui-react-native 0.17.67 → 0.17.68-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 (202) 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 +2 -1
  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 +123 -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/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 +111 -43
  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 +32 -75
  35. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +249 -0
  36. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  37. package/themes/business/src/components/PreviousOrders/index.tsx +444 -242
  38. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  39. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  40. package/themes/business/src/components/ReviewCustomer/index.tsx +30 -15
  41. package/themes/business/src/components/StoresList/index.tsx +3 -4
  42. package/themes/business/src/components/UserProfileForm/index.tsx +11 -13
  43. package/themes/business/src/components/shared/OLink.tsx +33 -13
  44. package/themes/business/src/components/shared/OModal.tsx +16 -9
  45. package/themes/business/src/components/shared/OText.tsx +8 -2
  46. package/themes/business/src/types/index.tsx +28 -12
  47. package/themes/business/src/utils/index.tsx +29 -2
  48. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  50. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  52. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  53. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  54. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  55. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  56. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  57. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  58. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  59. package/themes/original/index.tsx +2 -0
  60. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  61. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  62. package/themes/original/src/components/AddressList/index.tsx +27 -22
  63. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  64. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  65. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  66. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  68. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  69. package/themes/original/src/components/BusinessController/index.tsx +80 -66
  70. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  71. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  72. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  73. package/themes/original/src/components/BusinessInformation/index.tsx +139 -85
  74. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  75. package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
  76. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  77. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  78. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  79. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  80. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  81. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  82. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -556
  83. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  84. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  88. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  89. package/themes/original/src/components/Cart/index.tsx +77 -79
  90. package/themes/original/src/components/CartContent/index.tsx +117 -20
  91. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  92. package/themes/original/src/components/Checkout/index.tsx +356 -124
  93. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  94. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  95. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  96. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  97. package/themes/original/src/components/Favorite/index.tsx +8 -9
  98. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  99. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  100. package/themes/original/src/components/FloatingButton/index.tsx +11 -14
  101. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  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 +8 -8
  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 -31
  123. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  124. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  125. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  126. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  127. package/themes/original/src/components/Messages/index.tsx +14 -7
  128. package/themes/original/src/components/MomentOption/index.tsx +195 -90
  129. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  130. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  131. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  132. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  133. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  134. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  135. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  136. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  137. package/themes/original/src/components/MyOrders/index.tsx +40 -29
  138. package/themes/original/src/components/NavBar/index.tsx +20 -17
  139. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  140. package/themes/original/src/components/Notifications/index.tsx +46 -50
  141. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  142. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  143. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  144. package/themes/original/src/components/OrderDetails/index.tsx +191 -363
  145. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  146. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  147. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  148. package/themes/original/src/components/OrderSummary/index.tsx +88 -59
  149. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  150. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  151. package/themes/original/src/components/OrdersOption/index.tsx +68 -87
  152. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  153. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  154. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  155. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  156. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  157. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  158. package/themes/original/src/components/PaymentOptions/index.tsx +78 -35
  159. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  160. package/themes/original/src/components/ProductForm/index.tsx +105 -30
  161. package/themes/original/src/components/ProductForm/styles.tsx +5 -5
  162. package/themes/original/src/components/ProductItemAccordion/index.tsx +14 -11
  163. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  164. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  165. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  166. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  167. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  168. package/themes/original/src/components/Promotions/index.tsx +5 -4
  169. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  170. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  171. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  172. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  173. package/themes/original/src/components/Sessions/index.tsx +11 -8
  174. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  175. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  176. package/themes/original/src/components/SingleOrderCard/index.tsx +101 -62
  177. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  178. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  180. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  181. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  182. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  183. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  184. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  185. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  186. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  187. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  188. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  189. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  190. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  191. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  192. package/themes/original/src/components/UserVerification/index.tsx +52 -49
  193. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  194. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  195. package/themes/original/src/components/Wallets/index.tsx +66 -30
  196. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  197. package/themes/original/src/components/shared/OButton.tsx +6 -2
  198. package/themes/original/src/components/shared/OInput.tsx +6 -1
  199. package/themes/original/src/components/shared/OModal.tsx +3 -3
  200. package/themes/original/src/types/index.tsx +41 -11
  201. package/themes/original/src/utils/index.tsx +273 -1
  202. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -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'),
@@ -176,12 +178,8 @@ const ChatUI = (props: MessagesParams) => {
176
178
  fontSize: 12,
177
179
  },
178
180
  toolbarStyle: {
179
- flexDirection: 'column-reverse',
180
- paddingVertical: 15,
181
- paddingHorizontal: 30,
182
- backgroundColor: theme.colors.white,
183
- borderTopWidth: 1,
184
- borderTopColor: theme.colors.tabBar,
181
+ padding: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
182
+ flexDirection: 'column-reverse'
185
183
  },
186
184
  accessoryIcon: {
187
185
  height: 32,
@@ -314,14 +312,15 @@ const ChatUI = (props: MessagesParams) => {
314
312
  quality: 1
315
313
  },
316
314
  (response: any) => {
317
- if (response.didCancel) {
315
+ const image = response.assets[0];
316
+ if (image.didCancel) {
318
317
  console.log('User cancelled image picker');
319
- } else if (response.errorMessage) {
320
- console.log('ImagePicker Error: ', response.errorMessage);
321
- showToast(ToastType.Error, response.errorMessage);
318
+ } else if (image.errorMessage) {
319
+ console.log('ImagePicker Error: ', image.errorMessage);
320
+ showToast(ToastType.Error, image.errorMessage);
322
321
  } else {
323
- if (response.uri) {
324
- const url = `data:${response.type};base64,${response.base64}`;
322
+ if (image.uri) {
323
+ const url = `data:${image.type};base64,${image.base64}`;
325
324
  setImage && setImage(url);
326
325
  } else {
327
326
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
@@ -586,16 +585,12 @@ const ChatUI = (props: MessagesParams) => {
586
585
  };
587
586
 
588
587
  const renderAccessory = () => (
588
+ !chatDisabled &&
589
589
  <View>
590
590
  <Header
591
591
  showsVerticalScrollIndicator={false}
592
592
  showsHorizontalScrollIndicator={false}
593
593
  horizontal
594
- // contentContainerStyle={{
595
- // justifyContent:
596
- // orientation === 'Landscape' ? 'center' : 'space-between',
597
- // width: '100%',
598
- // }}
599
594
  nestedScrollEnabled={true}
600
595
  >
601
596
  {user?.level !== 2 && (
@@ -766,113 +761,130 @@ const ChatUI = (props: MessagesParams) => {
766
761
  containerStyle={styles.toolbarStyle}
767
762
  primaryStyle={{ alignItems: 'center', justifyContent: 'space-between' }}
768
763
  accessoryStyle={{ position: 'relative', marginBottom: 45 }}
769
- renderAccessory={order ? () => renderAccessory && renderAccessory() : undefined}
764
+ renderAccessory={() => renderAccessory()}
770
765
  />
771
766
  );
772
767
 
773
768
  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,
769
+ chatDisabled ? (
770
+ <View
771
+ style={{
772
+ width: '100%',
773
+ flexDirection: 'column',
774
+ alignItems: 'center'
804
775
  }}
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
- }}>
776
+ >
814
777
  <MaterialCommunityIcon
815
- name="pen"
816
- color={
817
- isShowSignaturePad ? theme.colors.primary : theme.colors.arrowColor
818
- }
778
+ name='close-octagon-outline'
819
779
  size={24}
820
780
  />
821
- </TouchableOpacity>
822
-
823
- {!file.type && (
824
- <Actions
781
+ <OText size={14}>{t('NOT_SEND_MESSAGES', 'You can\'t send messages because the order has ended')}</OText>
782
+ </View>
783
+ ) : (
784
+ <View
785
+ style={{
786
+ flexDirection: 'row',
787
+ height: 44,
788
+ width: '85%',
789
+ backgroundColor: theme.colors.composerView,
790
+ borderRadius: 7.6,
791
+ alignItems: 'center',
792
+ justifyContent: 'center',
793
+ paddingRight: 10,
794
+ }}>
795
+ <Composer
825
796
  {...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
- )}
797
+ textInputStyle={{
798
+ borderRadius: 7.6,
799
+ borderColor: theme.colors.transparent,
800
+ borderWidth: 0,
801
+ color: '#010300',
802
+ }}
803
+ textInputProps={{
804
+ value: message,
805
+ onSubmitEditing: onSubmit,
806
+ returnKeyType: message ? 'send' : 'done',
807
+ blurOnSubmit: true,
808
+ multiline: false,
809
+ numberOfLines: 1,
810
+ autoCorrect: false,
811
+ autoCompleteType: 'off',
812
+ enablesReturnKeyAutomatically: false,
813
+ selectionColor: theme.colors.primary,
814
+ }}
815
+ placeholder={t('WRITE_MESSAGE', 'Write message')}
816
+ placeholderTextColor={theme.colors.composerPlaceHolder}
870
817
  />
871
- )}
872
- </View>
818
+
819
+ <TouchableOpacity
820
+ onPress={() => {
821
+ setImage && setImage(null);
822
+ setIsShowSignaturePad(!isShowSignaturePad);
823
+ }}>
824
+ <MaterialCommunityIcon
825
+ name="pen"
826
+ color={
827
+ isShowSignaturePad ? theme.colors.primary : theme.colors.arrowColor
828
+ }
829
+ size={24}
830
+ />
831
+ </TouchableOpacity>
832
+
833
+ {!file.type && (
834
+ <Actions
835
+ {...props}
836
+ containerStyle={styles.containerActions}
837
+ optionTintColor="#222845"
838
+ icon={() => (
839
+ <>
840
+ {!file?.type && (
841
+ <>
842
+ <OIconButton
843
+ borderColor={theme.colors.transparent}
844
+ icon={
845
+ !isShowSignaturePad && image
846
+ ? { uri: image }
847
+ : theme.images.general.imageChat
848
+ }
849
+ iconStyle={{
850
+ borderRadius: image ? 10 : 0,
851
+ width: image ? 32 : 28,
852
+ height: image ? 32 : 28,
853
+ }}
854
+ onClick={handleImagePicker}
855
+ iconCover
856
+ />
857
+
858
+ {!!image && !isShowSignaturePad && (
859
+ <TouchableOpacity
860
+ style={{
861
+ position: 'absolute',
862
+ top: -5,
863
+ right: -5,
864
+ borderColor: theme.colors.backgroundDark,
865
+ backgroundColor: theme.colors.white,
866
+ borderRadius: 25,
867
+ }}
868
+ onPress={() => removeImage()}>
869
+ <MaterialCommunityIcon
870
+ name="close-circle-outline"
871
+ color={theme.colors.backgroundDark}
872
+ size={24}
873
+ />
874
+ </TouchableOpacity>
875
+ )}
876
+ </>
877
+ )}
878
+ </>
879
+ )}
880
+ />
881
+ )}
882
+ </View>
883
+ )
873
884
  );
874
885
 
875
886
  const renderSend = (props: any) => (
887
+ !chatDisabled &&
876
888
  <Send
877
889
  {...props}
878
890
  disabled={
@@ -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>
@@ -80,9 +80,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
80
80
  locations.map((location: { lat: number; lng: number; level: number }) => {
81
81
  return location.level === 4 && driverLocation?.lat
82
82
  ? {
83
- latitude: driverLocation?.lat,
84
- longitude: driverLocation?.lng,
85
- }
83
+ latitude: driverLocation?.lat,
84
+ longitude: driverLocation?.lng,
85
+ }
86
86
  : { latitude: location.lat, longitude: location.lng };
87
87
  });
88
88
 
@@ -107,7 +107,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
107
107
  }
108
108
  let data = null;
109
109
  const details = {
110
- geometry: { location: { lat: pos.latitude, lng: pos.longitude } },
110
+ geometry: { location: { lat: pos?.latitude, lng: pos?.longitude } },
111
111
  };
112
112
  if (isSetInputs) {
113
113
  data = {
@@ -165,8 +165,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
165
165
  const lat1 = pointA.lat;
166
166
  const lon1 = pointA.lng;
167
167
 
168
- const lat2 = pointB.latitude;
169
- const lon2 = pointB.longitude;
168
+ const lat2 = pointB?.latitude;
169
+ const lon2 = pointB?.longitude;
170
170
 
171
171
  const R = 6371e3;
172
172
  const φ1 = lat1 * (Math.PI / 180);
@@ -201,11 +201,11 @@ export const GoogleMap = (props: GoogleMapsParams) => {
201
201
  content: !(errKey === 'ERROR_MAX_LIMIT_LOCATION_TO')
202
202
  ? [t(errKey, mapErrors[errKey])]
203
203
  : [
204
- `${t(errKey, mapErrors[errKey])} ${maxLimitLocation} ${t(
205
- 'METTERS',
206
- 'meters',
207
- )}`,
208
- ],
204
+ `${t(errKey, mapErrors[errKey])} ${maxLimitLocation} ${t(
205
+ 'METTERS',
206
+ 'meters',
207
+ )}`,
208
+ ],
209
209
  key: errKey,
210
210
  });
211
211
  };
@@ -237,9 +237,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
237
237
  MARKERS = locations.map((location: { lat: number; lng: number; level: number }) => {
238
238
  return location.level === 4 && driverLocation?.lat
239
239
  ? {
240
- latitude: driverLocation?.lat,
241
- longitude: driverLocation?.lng,
242
- }
240
+ latitude: driverLocation?.lat,
241
+ longitude: driverLocation?.lng,
242
+ }
243
243
  : { latitude: location.lat, longitude: location.lng };
244
244
  })
245
245
  fitAllMarkers();
@@ -284,7 +284,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
284
284
  onRegionChangeComplete={
285
285
  !readOnly
286
286
  ? coordinates => handleChangeRegion(coordinates)
287
- : () => {}
287
+ : () => { }
288
288
  }
289
289
  zoomTapEnabled
290
290
  zoomEnabled
@@ -302,12 +302,13 @@ export const GoogleMap = (props: GoogleMapsParams) => {
302
302
  i: number,
303
303
  ) => (
304
304
  <React.Fragment key={i}>
305
- <Marker
306
- coordinate={location}
307
- onPress={() => {
305
+ <Marker
306
+ coordinate={location}
307
+ onPress={() => {
308
308
  mapRef.current?.animateCamera({
309
- center: { latitude: location.latitude, longitude:location.longitude },
310
- })}}
309
+ center: { latitude: location?.latitude, longitude: location?.longitude },
310
+ })
311
+ }}
311
312
  >
312
313
  <Icon
313
314
  name="map-marker"
@@ -328,46 +329,46 @@ export const GoogleMap = (props: GoogleMapsParams) => {
328
329
  <Callout
329
330
  onPress={() => {
330
331
  showLocation({
331
- latitude: location.latitude,
332
- longitude: location.longitude,
333
- sourceLatitude: userLocation.latitude,
334
- sourceLongitude: userLocation.longitude,
335
- naverCallerName: 'com.businessapp',
336
- dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
337
- dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
338
- cancelText: t('CANCEL', 'Cancel'),
332
+ latitude: location?.latitude,
333
+ longitude: location?.longitude,
334
+ sourceLatitude: userLocation?.latitude,
335
+ sourceLongitude: userLocation.longitude,
336
+ naverCallerName: 'com.businessapp',
337
+ dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
338
+ dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
339
+ cancelText: t('CANCEL', 'Cancel'),
339
340
  })
340
341
  }}
341
342
  >
342
- <View style={{flex: 1,width: 250, paddingRight: 10, paddingLeft: 10, justifyContent:'space-between' }}>
343
- <View style={{flex: 1, marginBottom: 20}}>
344
- <OText size={16} weight={'bold'} style={{paddingTop: 10, marginBottom: 10}}>{locations[i]?.title}</OText>
345
- { locations[i]?.address && (
346
- <>
347
- <OText size={16} >{locations[i]?.address.addressName}</OText>
348
- <OText size={16} >{locations[i]?.address.zipcode}</OText>
349
- </>
350
- )}
351
- </View>
352
- <OButton
353
- text={t('GO_TO_THIS_LOCATION', 'Go to this location')}
354
- imgRightSrc={null}
355
- textStyle={{
356
- color: theme.colors.white,
357
- fontFamily: 'Poppins',
358
- fontStyle: 'normal',
359
- fontWeight: 'normal',
360
- fontSize: 16
361
- }}
362
- style={{
363
- alignContent:'center',
364
- borderRadius: 10,
365
- height: 35,
366
- bottom:10
367
- }}
368
- bgColor={theme.colors.primary}
369
- borderColor={theme.colors.primary}
370
- />
343
+ <View style={{ flex: 1, width: 250, paddingRight: 10, paddingLeft: 10, justifyContent: 'space-between' }}>
344
+ <View style={{ flex: 1, marginBottom: 20 }}>
345
+ <OText size={16} weight={'bold'} style={{ paddingTop: 10, marginBottom: 10 }}>{locations[i]?.title}</OText>
346
+ {locations[i]?.address && (
347
+ <>
348
+ <OText size={16} >{locations[i]?.address.addressName}</OText>
349
+ <OText size={16} >{locations[i]?.address.zipcode}</OText>
350
+ </>
351
+ )}
352
+ </View>
353
+ <OButton
354
+ text={t('GO_TO_THIS_LOCATION', 'Go to this location')}
355
+ imgRightSrc={null}
356
+ textStyle={{
357
+ color: theme.colors.white,
358
+ fontFamily: 'Poppins',
359
+ fontStyle: 'normal',
360
+ fontWeight: 'normal',
361
+ fontSize: 16
362
+ }}
363
+ style={{
364
+ alignContent: 'center',
365
+ borderRadius: 10,
366
+ height: 35,
367
+ bottom: 10
368
+ }}
369
+ bgColor={theme.colors.primary}
370
+ borderColor={theme.colors.primary}
371
+ />
371
372
  </View>
372
373
  </Callout>
373
374
  </Marker>