ordering-ui-react-native 0.16.9 → 0.16.10-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 (219) hide show
  1. package/package.json +8 -4
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/LanguageSelector/index.tsx +21 -16
  13. package/src/components/LoginForm/index.tsx +118 -30
  14. package/src/components/LoginForm/styles.tsx +6 -0
  15. package/src/components/Messages/index.tsx +2 -2
  16. package/src/components/NotificationSetting/index.tsx +85 -0
  17. package/src/components/OrderDetails/index.tsx +7 -21
  18. package/src/components/OrdersOption/index.tsx +54 -56
  19. package/src/components/PaymentOptions/index.tsx +335 -365
  20. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  21. package/src/components/ReviewDriver/index.tsx +1 -1
  22. package/src/components/ReviewOrder/index.tsx +2 -1
  23. package/src/components/ReviewProducts/index.tsx +11 -0
  24. package/src/components/SignupForm/index.tsx +143 -61
  25. package/src/components/SingleProductReview/index.tsx +8 -5
  26. package/src/components/StripeElementsForm/index.tsx +25 -16
  27. package/src/components/StripeMethodForm/index.tsx +1 -2
  28. package/src/components/VerifyPhone/styles.tsx +1 -2
  29. package/src/components/shared/OBottomPopup.tsx +6 -2
  30. package/src/index.tsx +2 -0
  31. package/src/navigators/CheckoutNavigator.tsx +6 -0
  32. package/src/navigators/HomeNavigator.tsx +6 -0
  33. package/src/pages/BusinessesListing.tsx +7 -6
  34. package/src/pages/MultiCheckout.tsx +31 -0
  35. package/src/pages/MultiOrdersDetails.tsx +27 -0
  36. package/src/pages/OrderDetails.tsx +1 -1
  37. package/src/pages/ReviewDriver.tsx +2 -2
  38. package/src/pages/ReviewOrder.tsx +2 -2
  39. package/src/theme.json +0 -1
  40. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  41. package/src/types/index.tsx +13 -9
  42. package/src/utils/index.tsx +0 -1
  43. package/themes/business/index.tsx +4 -0
  44. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  45. package/themes/business/src/components/Chat/index.tsx +42 -34
  46. package/themes/business/src/components/DriverMap/index.tsx +13 -10
  47. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  48. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  49. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  50. package/themes/business/src/components/MapView/index.tsx +1 -1
  51. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  52. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  53. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  54. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +19 -18
  55. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  56. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  57. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  58. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  59. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  61. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  62. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  63. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  65. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  66. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  67. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  68. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  69. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  70. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  71. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  72. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  73. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  74. package/themes/business/src/components/shared/OModal.tsx +40 -37
  75. package/themes/business/src/types/index.tsx +14 -9
  76. package/themes/business/src/utils/index.tsx +10 -0
  77. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  78. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  79. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  80. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  81. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  82. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  83. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  84. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  85. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  86. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  87. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  88. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  89. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  90. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  91. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  92. package/themes/kiosk/src/types/index.d.ts +2 -0
  93. package/themes/original/index.tsx +22 -0
  94. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  95. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  96. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  97. package/themes/original/src/components/AddressList/index.tsx +1 -1
  98. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  99. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  100. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  101. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  102. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  103. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  104. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  105. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  106. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  107. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  108. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  109. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  110. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  111. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  112. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  113. package/themes/original/src/components/BusinessProductsList/index.tsx +65 -72
  114. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  115. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -178
  116. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  117. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  118. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  119. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  120. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  121. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  122. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  123. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  124. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  125. package/themes/original/src/components/Cart/index.tsx +81 -36
  126. package/themes/original/src/components/Cart/styles.tsx +4 -0
  127. package/themes/original/src/components/CartContent/index.tsx +22 -16
  128. package/themes/original/src/components/Checkout/index.tsx +106 -66
  129. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  130. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  131. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  132. package/themes/original/src/components/Favorite/index.tsx +92 -0
  133. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  134. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  135. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  136. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  137. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  138. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  139. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  140. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  141. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  142. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  143. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  144. package/themes/original/src/components/Messages/index.tsx +17 -17
  145. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  146. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  147. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  148. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  149. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  150. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  151. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  152. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  153. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  154. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  155. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  156. package/themes/original/src/components/NavBar/index.tsx +11 -5
  157. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  158. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  159. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  160. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  161. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  162. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  163. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  164. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  165. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  166. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  168. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  170. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  171. package/themes/original/src/components/OrdersOption/index.tsx +130 -37
  172. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  173. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  174. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  175. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  176. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  177. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  178. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  179. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  180. package/themes/original/src/components/ProductItemAccordion/index.tsx +37 -24
  181. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  182. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  183. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  184. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  185. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  186. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  187. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  188. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  189. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  190. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  191. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  192. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  193. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  194. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  195. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  196. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  197. package/themes/original/src/components/SingleProductCard/index.tsx +215 -95
  198. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  199. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  200. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  201. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  202. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  203. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  204. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  205. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  206. package/themes/original/src/components/UserProfile/index.tsx +12 -1
  207. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  208. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  209. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  210. package/themes/original/src/components/Wallets/index.tsx +176 -162
  211. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  212. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  213. package/themes/original/src/components/shared/OButton.tsx +10 -3
  214. package/themes/original/src/components/shared/OInput.tsx +3 -2
  215. package/themes/original/src/components/shared/OModal.tsx +3 -1
  216. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  217. package/themes/original/src/types/index.tsx +200 -46
  218. package/themes/original/src/utils/index.tsx +77 -0
  219. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -49,7 +49,7 @@ export const ProductDescription = styled.View`
49
49
  `
50
50
 
51
51
  export const ProductEditions = styled.View`
52
-
52
+ padding: 0 40px;
53
53
  `
54
54
 
55
55
  export const SectionTitle = styled.View`
@@ -65,26 +65,24 @@ export const WrapperSubOption = styled.View`
65
65
  `
66
66
 
67
67
  export const ProductComment = styled.View`
68
- padding-bottom: 50px;
68
+ padding-bottom: ${(props: any) => props.pb || 60}px;
69
69
  `
70
70
 
71
71
  export const ProductActions = styled.View`
72
72
  position: absolute;
73
73
  bottom: 0px;
74
- min-height: 70px;
75
74
  padding-top: ${(props: any) => props.ios ? '20px' : '0'};
76
75
  padding-horizontal: 40px;
76
+ padding-vertical: 20px;
77
77
  width: 100%;
78
- flex-direction: row;
78
+ flex-direction: ${(props: any) => props.isColumn ? 'column' : 'row'};
79
79
  background-color: #FFF;
80
80
  z-index: 1000;
81
- align-items: center;
82
- justify-content: space-between;
83
81
  border-top-width: 1px;
84
82
  border-top-color: ${(props: any) => props.theme.colors.border};
85
83
  `
86
84
  export const ExtraOptionWrap = styled.ScrollView`
87
- margin-horizontal: -40px;
85
+ margin-horizontal: 30px;
88
86
  `;
89
87
 
90
88
  export const WeightUnitSwitch = styled.View`
@@ -99,4 +97,8 @@ export const WeightUnitItem = styled.View`
99
97
  `}
100
98
  `
101
99
  export const ProductSummary = styled.View`
100
+ padding: 26px 40px;
101
+ position: relative;
102
+ background-color: white;
103
+ z-index: 100;
102
104
  `
@@ -68,7 +68,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
68
68
 
69
69
  const [, t] = useLanguage()
70
70
  const [orderState] = useOrder()
71
- const [{ parsePrice, optimizeImage }] = useUtils()
71
+ const [{ parsePrice, optimizeImage, parseDate }] = useUtils()
72
72
 
73
73
  const [isActive, setActiveState] = useState(false)
74
74
  // const [setHeight, setHeightState] = useState({ height: new Animated.Value(0) })
@@ -152,31 +152,44 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
152
152
  )}
153
153
  </ProductImage>
154
154
  )}
155
- {isCartProduct && !isCartPending && getProductMax && (
156
- <ProductInfo>
157
- <RNPickerSelect
158
- items={productOptions}
159
- onValueChange={handleChangeQuantity}
160
- value={product.quantity.toString()}
161
- style={pickerStyle}
162
- useNativeAndroidPickerStyle={false}
163
- placeholder={{}}
164
- Icon={() => <View style={pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.textNormal} width={8} /></View>}
165
- disabled={orderState.loading}
166
- />
167
- </ProductInfo>
168
- )}
169
- {isFromCheckout && (
170
- <ProductQuantity>
171
- <OText size={12} lineHeight={18}>
172
- {product?.quantity}
155
+ {!!product?.calendar_event ? (
156
+ <View style={{ flex: 1, marginLeft: 10, flexDirection: 'column' }}>
157
+ <View>
158
+ <OText size={12} lineHeight={18} weight={'400'} numberOfLines={1}>{product?.name}</OText>
159
+ </View>
160
+ <OText size={10} color={theme.colors.textSecondary} style={{ marginTop: 3 }}>
161
+ {parseDate(product?.calendar_event?.start, { outputFormat: 'hh:mm a' })} - {parseDate(product?.calendar_event?.end, { outputFormat: 'hh:mm a' })}
173
162
  </OText>
174
- </ProductQuantity>
163
+ </View>
164
+ ): (
165
+ <>
166
+ {isCartProduct && !isCartPending && getProductMax && (
167
+ <ProductInfo>
168
+ <RNPickerSelect
169
+ items={productOptions}
170
+ onValueChange={handleChangeQuantity}
171
+ value={product.quantity.toString()}
172
+ style={pickerStyle}
173
+ useNativeAndroidPickerStyle={false}
174
+ placeholder={{}}
175
+ Icon={() => <View style={pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.textNormal} width={8} /></View>}
176
+ disabled={orderState.loading}
177
+ />
178
+ </ProductInfo>
179
+ )}
180
+ {isFromCheckout && (
181
+ <ProductQuantity>
182
+ <OText size={12} lineHeight={18}>
183
+ {product?.quantity}
184
+ </OText>
185
+ </ProductQuantity>
186
+ )}
187
+ <View style={{ flex: 1 }}>
188
+ <OText size={12} lineHeight={18} weight={'400'}>{product.name}</OText>
189
+ </View>
190
+ </>
175
191
  )}
176
- <View style={{ flex: 1 }}>
177
- <OText size={12} lineHeight={18} weight={'400'}>{product.name}</OText>
178
- </View>
179
- <View style={{ display: 'flex', flexDirection: 'column', flex: 1, alignItems: 'flex-end' }}>
192
+ <View style={{ display: 'flex', flexDirection: 'column', flex: 1, alignItems: 'flex-end', maxWidth: 100 }}>
180
193
  <View style={{ flexDirection: 'row' }}>
181
194
  <OText size={12} lineHeight={18} weight={'400'}>{parsePrice(product.total || product.price)}</OText>
182
195
  {(productInfo().ingredients.length > 0 || productInfo().options.length > 0 || product.comment) && (
@@ -30,7 +30,7 @@ const ProductOptionUI = (props: any) => {
30
30
  return (
31
31
  <Container style={{ color: error ? 'orange' : theme.colors.white }}>
32
32
  <WrapHeader>
33
- <OText size={16} lineHeight={24} weight={'600'}>{option.name}</OText>
33
+ <OText size={16} lineHeight={24} weight={'600'} style={{ flex: 1 }}>{option.name}</OText>
34
34
  <OText color={theme.colors.red}>{maxMin}</OText>
35
35
  </WrapHeader>
36
36
  {children}
@@ -0,0 +1,129 @@
1
+ import React, { useState } from 'react'
2
+ import { ScrollView, TouchableOpacity, View, StyleSheet, Platform } from 'react-native'
3
+ import { useUtils, useLanguage } from 'ordering-components/native'
4
+ import { useTheme } from 'styled-components/native'
5
+ import FastImage from 'react-native-fast-image'
6
+ import { OIcon, OText, OModal } from '../shared'
7
+ import { ProfessionalProfile } from '../ProfessionalProfile'
8
+ import { ProfessionalFilterParams } from '../../types'
9
+
10
+ export const ProfessionalFilter = (props: ProfessionalFilterParams) => {
11
+ const {
12
+ professionals,
13
+ professionalSelected,
14
+ handleChangeProfessionalSelected
15
+ } = props
16
+
17
+ const theme = useTheme()
18
+ const [{ optimizeImage }] = useUtils()
19
+ const [, t] = useLanguage()
20
+ const [open, setOpen] = useState(false)
21
+ const [currentProfessional, setCurrentProfessional] = useState(null)
22
+
23
+ const handleOpenProfile = (professional: any) => {
24
+ setCurrentProfessional(professional)
25
+ setOpen(true)
26
+ }
27
+
28
+ const handleCloseProfile = () => {
29
+ setCurrentProfessional(null)
30
+ setOpen(false)
31
+ }
32
+
33
+ const styles = StyleSheet.create({
34
+ professionalItem: {
35
+ flexDirection: 'row',
36
+ alignItems: 'center',
37
+ borderRadius: 7.6,
38
+ padding: 11,
39
+ borderWidth: 1,
40
+ marginRight: 12,
41
+ minHeight: 64
42
+ },
43
+ photoStyle: {
44
+ width: 42,
45
+ height: 42,
46
+ borderRadius: 7.6
47
+ }
48
+ })
49
+
50
+ return (
51
+ <>
52
+ <ScrollView
53
+ horizontal
54
+ showsVerticalScrollIndicator={false}
55
+ showsHorizontalScrollIndicator={false}
56
+ >
57
+ <TouchableOpacity
58
+ onPress={() => handleChangeProfessionalSelected(null)}
59
+ >
60
+ <View
61
+ style={{
62
+ ...styles.professionalItem,
63
+ borderColor: !professionalSelected
64
+ ? theme.colors.primary
65
+ : theme.colors.border
66
+ }}
67
+ >
68
+ <OText
69
+ size={12}
70
+ weight={'400'}
71
+ >
72
+ {t('ANY_PROFESSIONAL_MEMBER', 'Any professional member')}
73
+ </OText>
74
+ </View>
75
+ </TouchableOpacity>
76
+ {professionals.map((professional: any, i: number) => (
77
+ <TouchableOpacity
78
+ key={i}
79
+ onPress={() => handleOpenProfile(professional)}
80
+ >
81
+ <View
82
+ style={{
83
+ ...styles.professionalItem,
84
+ borderColor: (professional?.id === professionalSelected?.id)
85
+ ? theme.colors.primary
86
+ : theme.colors.border
87
+ }}
88
+ >
89
+ {professional?.photo ? (
90
+ <FastImage
91
+ style={styles.photoStyle}
92
+ source={{
93
+ uri: optimizeImage(professional?.photo, 'h_250,c_limit'),
94
+ priority: FastImage.priority.normal,
95
+ }}
96
+ resizeMode={FastImage.resizeMode.cover}
97
+ />
98
+ ) : (
99
+ <OIcon
100
+ src={theme?.images?.general?.user}
101
+ cover={false}
102
+ style={styles.photoStyle}
103
+ />
104
+ )}
105
+ <OText
106
+ size={12}
107
+ style={{ marginLeft: 12 }}
108
+ weight={'400'}
109
+ >
110
+ {professional?.name} {professional?.lastname}
111
+ </OText>
112
+ </View>
113
+ </TouchableOpacity>
114
+ ))}
115
+ </ScrollView>
116
+ <OModal
117
+ open={open}
118
+ onClose={() => handleCloseProfile()}
119
+ entireModal
120
+ >
121
+ <ProfessionalProfile
122
+ professional={currentProfessional}
123
+ onClose={() => handleCloseProfile()}
124
+ handleChangeProfessionalSelected={handleChangeProfessionalSelected}
125
+ />
126
+ </OModal>
127
+ </>
128
+ )
129
+ }
@@ -0,0 +1,309 @@
1
+ import React, { useState, useEffect, useRef } from 'react'
2
+ import { StyleSheet, Platform, View, Dimensions } from 'react-native'
3
+ import { useUtils, useLanguage, useConfig } from 'ordering-components/native'
4
+ import { useTheme } from 'styled-components/native'
5
+ import CalendarPicker from 'react-native-calendar-picker'
6
+ import FeatherIcon from 'react-native-vector-icons/Feather';
7
+ import moment from 'moment'
8
+ import SelectDropdown from 'react-native-select-dropdown'
9
+ import { OButton, OText, OIcon } from '../shared'
10
+ import IconAntDesign from 'react-native-vector-icons/AntDesign'
11
+ import { useSafeAreaInsets } from 'react-native-safe-area-context'
12
+ import { ProfessionalProfileParams } from '../../types'
13
+
14
+ import {
15
+ Container,
16
+ ProfessionalPhoto,
17
+ InfoWrapper,
18
+ Divider,
19
+ ScheduleWrapper,
20
+ ButtonWrapper,
21
+ CalendarWrapper
22
+ } from './styles'
23
+
24
+ const windowWidth = Dimensions.get('window').width
25
+
26
+ export const ProfessionalProfile = (props: ProfessionalProfileParams) => {
27
+ const {
28
+ professional,
29
+ handleChangeProfessionalSelected,
30
+ onClose
31
+ } = props
32
+
33
+ const [{ optimizeImage }] = useUtils()
34
+ const theme = useTheme()
35
+ const [, t] = useLanguage()
36
+ const [{ configs }] = useConfig()
37
+ const { top } = useSafeAreaInsets()
38
+
39
+ const [selectDate, setSelectedDate] = useState<any>(new Date())
40
+ const [isEnabled, setIsEnabled] = useState(false)
41
+ const [timeList, setTimeList] = useState<any>([])
42
+ const dropdownRef = useRef<any>(null)
43
+
44
+ const styles = StyleSheet.create({
45
+ buttonStyle: {
46
+ borderRadius: 7.6,
47
+ height: 44,
48
+ borderWidth: 0
49
+ },
50
+ selectOption: {
51
+ width: '100%',
52
+ backgroundColor: theme.colors.backgroundGray100,
53
+ paddingVertical: 5,
54
+ paddingHorizontal: 14,
55
+ flexDirection: 'row-reverse',
56
+ alignItems: 'center',
57
+ justifyContent: 'space-between',
58
+ height: 40,
59
+ marginBottom: 30
60
+ },
61
+ photoStyle: {
62
+ alignSelf: 'center'
63
+ }
64
+ })
65
+
66
+ const onDateChange = (date: any) => {
67
+ setSelectedDate(date)
68
+ dropdownRef?.current && dropdownRef.current.reset()
69
+ }
70
+
71
+ const dropDownIcon = () => {
72
+ return (
73
+ <IconAntDesign
74
+ name='down'
75
+ color={theme.colors.textThird}
76
+ size={12}
77
+ />
78
+ )
79
+ }
80
+
81
+ const customDayHeaderStylesCallback = () => {
82
+ return {
83
+ textStyle: {
84
+ color: theme.colors.disabled,
85
+ fontSize: 12,
86
+ },
87
+ };
88
+ };
89
+
90
+ const validateSelectedDate = (curdate: any, menu: any) => {
91
+ const day = moment(curdate).format('d')
92
+ setIsEnabled(menu?.schedule?.[day]?.enabled || false)
93
+ }
94
+
95
+ const getTimes = (curdate: any, menu: any) => {
96
+ validateSelectedDate(curdate, menu)
97
+ const date = new Date()
98
+ var dateSeleted = new Date(curdate)
99
+ var times = []
100
+ for (var k = 0; k < menu.schedule[dateSeleted.getDay()].lapses.length; k++) {
101
+ var open = {
102
+ hour: menu.schedule[dateSeleted.getDay()].lapses[k].open.hour,
103
+ minute: menu.schedule[dateSeleted.getDay()].lapses[k].open.minute
104
+ }
105
+ var close = {
106
+ hour: menu.schedule[dateSeleted.getDay()].lapses[k].close.hour,
107
+ minute: menu.schedule[dateSeleted.getDay()].lapses[k].close.minute
108
+ }
109
+ for (var i = open.hour; i <= close.hour; i++) {
110
+ if (date.getDate() !== dateSeleted.getDate() || i >= date.getHours()) {
111
+ let hour = ''
112
+ let meridian = ''
113
+ if (configs?.format_time?.value === '12') {
114
+ if (i === 0) {
115
+ hour = '12'
116
+ meridian = ' ' + t('AM', 'AM')
117
+ } else if (i > 0 && i < 12) {
118
+ hour = (i < 10 ? '0' + i : i)
119
+ meridian = ' ' + t('AM', 'AM')
120
+ } else if (i === 12) {
121
+ hour = '12'
122
+ meridian = ' ' + t('PM', 'PM')
123
+ } else {
124
+ hour = ((i - 12 < 10) ? '0' + (i - 12) : `${(i - 12)}`)
125
+ meridian = ' ' + t('PM', 'PM')
126
+ }
127
+ } else {
128
+ hour = i < 10 ? '0' + i : i
129
+ }
130
+ for (let j = (i === open.hour ? open.minute : 0); j <= (i === close.hour ? close.minute : 59); j += 15) {
131
+ if (i !== date.getHours() || j >= date.getMinutes() || date.getDate() !== dateSeleted.getDate()) {
132
+ times.push({
133
+ text: hour + ':' + (j < 10 ? '0' + j : j) + meridian,
134
+ value: (i < 10 ? '0' + i : i) + ':' + (j < 10 ? '0' + j : j)
135
+ })
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }
141
+ return times
142
+ }
143
+
144
+ const handleSelectProfessional = () => {
145
+ handleChangeProfessionalSelected(professional)
146
+ onClose && onClose()
147
+ }
148
+
149
+ useEffect(() => {
150
+ if (selectDate === null) return
151
+ const _times = getTimes(selectDate, professional)
152
+ setTimeList(_times)
153
+ }, [selectDate, professional])
154
+
155
+ return (
156
+ <Container>
157
+ {!!professional?.photo ? (
158
+ <ProfessionalPhoto
159
+ source={{
160
+ uri: professional?.photo
161
+ }}
162
+ />
163
+ ) : (
164
+ <OIcon
165
+ src={theme.images.general.user}
166
+ style={styles.photoStyle}
167
+ cover={false}
168
+ width={200}
169
+ height={200}
170
+ />
171
+ )}
172
+ <InfoWrapper>
173
+ <OText
174
+ size={20}
175
+ style={{ marginBottom: 3 }}
176
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
177
+ >
178
+ {professional?.name} {professional?.lastname}
179
+ </OText>
180
+ </InfoWrapper>
181
+ <Divider />
182
+ <ScheduleWrapper>
183
+ <View
184
+ style={{
185
+ flexDirection: 'row',
186
+ justifyContent: 'space-between',
187
+ alignItems: 'center',
188
+ marginBottom: 23
189
+ }}
190
+ >
191
+ <OText
192
+ size={16}
193
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
194
+ >
195
+ {t('SCHEDULE', 'Schedule')}
196
+ </OText>
197
+ <OText
198
+ size={10}
199
+ weight={'400'}
200
+ color={theme.colors?.danger5}
201
+ >
202
+ {t('REQUIRED', 'Required')}
203
+ </OText>
204
+ </View>
205
+ {!!professional?.schedule ? (
206
+ <CalendarWrapper>
207
+ {(timeList?.length > 0 && isEnabled) ? (
208
+ <SelectDropdown
209
+ ref={dropdownRef}
210
+ data={timeList}
211
+ onSelect={(selectedItem, index) => {
212
+ console.log(selectedItem.value)
213
+ }}
214
+ buttonTextAfterSelection={(selectedItem, index) => {
215
+ return selectedItem.text
216
+ }}
217
+ rowTextForSelection={(item, index) => {
218
+ return item.text
219
+ }}
220
+ buttonStyle={{borderRadius: 7.6, ...styles.selectOption}}
221
+ buttonTextStyle={{
222
+ color: theme.colors.disabled,
223
+ fontSize: 14,
224
+ textAlign: 'left',
225
+ marginHorizontal: 0
226
+ }}
227
+ dropdownStyle={{
228
+ borderRadius: 8,
229
+ borderColor: theme.colors.lightGray,
230
+ marginTop: Platform.OS === 'ios' ? 12 : -top
231
+ }}
232
+ rowStyle={{
233
+ borderBottomColor: theme.colors.backgroundGray100,
234
+ backgroundColor: theme.colors.backgroundGray100,
235
+ height: 30,
236
+ flexDirection: 'column',
237
+ alignItems: 'flex-start',
238
+ paddingTop: 8,
239
+ paddingHorizontal: 12
240
+ }}
241
+ rowTextStyle={{
242
+ color: theme.colors.disabled,
243
+ fontSize: 14,
244
+ marginHorizontal: 0
245
+ }}
246
+ renderDropdownIcon={() => dropDownIcon()}
247
+ dropdownOverlayColor='transparent'
248
+ />
249
+ ) : (
250
+ <OText
251
+ size={12}
252
+ style={{ marginBottom: 30 }}
253
+ weight={'400'}
254
+ color={theme.colors?.danger5}
255
+ >
256
+ {t('PROFESSIONAL_NOT_AVAILABLE', 'Professional is not available at the moment')}
257
+ </OText>
258
+ )}
259
+
260
+ <CalendarPicker
261
+ previousComponent={
262
+ <FeatherIcon
263
+ name='chevron-left'
264
+ color={theme.colors.disabled}
265
+ size={24}
266
+ style={{ marginHorizontal: 4 }}
267
+ />
268
+ }
269
+ nextComponent={
270
+ <FeatherIcon
271
+ name='chevron-right'
272
+ color={theme.colors.disabled}
273
+ size={24}
274
+ style={{ marginHorizontal: 4 }}
275
+ />
276
+ }
277
+ width={windowWidth - 110}
278
+ selectedDayTextColor={theme.colors.white}
279
+ selectedDayColor={theme.colors.primary}
280
+ todayBackgroundColor={theme.colors.border}
281
+ dayLabelsWrapper={{ borderColor: theme.colors.clear }}
282
+ onDateChange={onDateChange}
283
+ minDate={new Date()}
284
+ customDayHeaderStyles={customDayHeaderStylesCallback}
285
+ selectedStartDate={selectDate}
286
+ />
287
+ </CalendarWrapper>
288
+ ) : (
289
+ <OText
290
+ size={20}
291
+ style={{ marginBottom: 30 }}
292
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
293
+ >
294
+ {t('NO_SCHEDULE', 'No schedule')}
295
+ </OText>
296
+ )}
297
+ </ScheduleWrapper>
298
+ <ButtonWrapper>
299
+ <OButton
300
+ bgColor={theme.colors.primary}
301
+ onClick={() => handleSelectProfessional()}
302
+ text={t('BOOK', 'Book')}
303
+ style={styles.buttonStyle}
304
+ textStyle={{ fontSize: 14, color: theme.colors.white }}
305
+ />
306
+ </ButtonWrapper>
307
+ </Container>
308
+ )
309
+ }
@@ -0,0 +1,46 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.ScrollView``
4
+
5
+ export const ProfessionalPhoto = styled.ImageBackground`
6
+ width: 100%;
7
+ position: relative;
8
+ max-height: 258px;
9
+ height: 258px;
10
+ resize-mode: cover;
11
+ `;
12
+
13
+ export const InfoWrapper = styled.View`
14
+ margin-vertical: 30px;
15
+ padding-horizontal: 40px;
16
+ `
17
+
18
+ export const Divider = styled.View`
19
+ width: 100%;
20
+ height: 8px;
21
+ background-color: ${(props: any) => props.theme.colors.backgroundGray100};
22
+ `
23
+
24
+ export const ScheduleWrapper = styled.View`
25
+ padding-horizontal: 40px;
26
+ margin-top: 30px;
27
+ `
28
+
29
+ export const ButtonWrapper = styled.View`
30
+ justify-content: center;
31
+ flex-direction: row;
32
+ padding-vertical: 13px;
33
+ margin-top: 30px;
34
+ margin-bottom: 40px;
35
+ width: 100%;
36
+ border-top-width: 1px;
37
+ border-top-color: ${(props: any) => props.theme.colors.backgroundGray200};
38
+ `
39
+
40
+ export const CalendarWrapper = styled.View`
41
+ flex: 1;
42
+ border-width: 1px;
43
+ border-color: ${(props: any) => props.theme.colors.backgroundGray200};
44
+ border-radius: 7.6px;
45
+ padding: 15px;
46
+ `
@@ -44,7 +44,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
44
44
  photoWrapper: {
45
45
  shadowColor: theme.colors.black,
46
46
  shadowRadius: 3,
47
- shadowOffset: {width: 1, height: 4},
47
+ shadowOffset: { width: 1, height: 4 },
48
48
  elevation: 3,
49
49
  borderRadius: 8,
50
50
  shadowOpacity: 0.1,
@@ -86,11 +86,11 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
86
86
  const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
87
87
 
88
88
  const qualificationList = [
89
- { key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0, parentStyle: { left: '0%' }, isInnerStyle: false, pointerColor: false },
89
+ { key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0, parentStyle: { left: '0%' }, isInnerStyle: false, pointerColor: false },
90
90
  { key: 2, text: t('BAD', 'Bad'), percent: 0.25, parentStyle: { left: '25%' }, isInnerStyle: true, pointerColor: true },
91
91
  { key: 3, text: t('OKAY', 'Okay'), percent: 0.5, parentStyle: { left: '50%' }, isInnerStyle: true, pointerColor: true },
92
92
  { key: 4, text: t('GOOD', 'Good'), percent: 0.75, parentStyle: { left: '75%' }, isInnerStyle: true, pointerColor: true },
93
- { key: 5, text: t('GREAT', 'Great'), percent: 1, parentStyle: { right: '0%' }, isInnerStyle: false, pointerColor: false }
93
+ { key: 5, text: t('GREAT', 'Great'), percent: 1, parentStyle: { right: '0%' }, isInnerStyle: false, pointerColor: false }
94
94
  ]
95
95
 
96
96
  const commentsList = reviewCommentList('driver')
@@ -204,7 +204,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
204
204
  <OIcon
205
205
  url={order?.driver?.photo}
206
206
  src={!order?.driver?.photo && theme.images.general.user}
207
- cover={order?.driver?.photo ? true: false}
207
+ cover={order?.driver?.photo ? true : false}
208
208
  width={80}
209
209
  height={80}
210
210
  />
@@ -212,7 +212,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
212
212
  <OText weight={500} style={{ marginVertical: 10 }} color={theme.colors.textNormal}>{order?.driver?.name} {order?.driver?.lastname}</OText>
213
213
  </DriverPhotoContainer>
214
214
 
215
- <View style={{flex: 1, justifyContent: 'flex-end'}}>
215
+ <View style={{ flex: 1, justifyContent: 'flex-end' }}>
216
216
  <FormReviews>
217
217
  <OText mBottom={13} color={theme.colors.textNormal}>{t('HOW_WAS_YOUR_DRIVER', 'How was your driver?')}</OText>
218
218
  <RatingBarContainer>
@@ -264,7 +264,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
264
264
  style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
265
265
  imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
266
266
  imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
267
- onClick={() => handleChangeComment(commentItem) }
267
+ onClick={() => handleChangeComment(commentItem)}
268
268
  />
269
269
  ))}
270
270
  </CommentsButtonGroup>