ordering-ui-react-native 0.16.37 → 0.16.38-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 +7 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/LoginForm/index.tsx +15 -0
  13. package/src/components/Messages/index.tsx +2 -2
  14. package/src/components/NotificationSetting/index.tsx +85 -0
  15. package/src/components/OrderDetails/index.tsx +2 -20
  16. package/src/components/OrdersOption/index.tsx +54 -56
  17. package/src/components/PaymentOptions/index.tsx +335 -365
  18. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  19. package/src/components/ReviewDriver/index.tsx +1 -1
  20. package/src/components/ReviewOrder/index.tsx +2 -1
  21. package/src/components/ReviewProducts/index.tsx +11 -0
  22. package/src/components/SignupForm/index.tsx +15 -0
  23. package/src/components/SingleProductReview/index.tsx +8 -5
  24. package/src/components/StripeElementsForm/index.tsx +25 -16
  25. package/src/components/VerifyPhone/styles.tsx +1 -2
  26. package/src/components/shared/OBottomPopup.tsx +6 -2
  27. package/src/index.tsx +2 -0
  28. package/src/pages/BusinessesListing.tsx +7 -6
  29. package/src/pages/OrderDetails.tsx +1 -1
  30. package/src/pages/ReviewDriver.tsx +2 -2
  31. package/src/pages/ReviewOrder.tsx +2 -2
  32. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  33. package/src/utils/index.tsx +2 -1
  34. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  35. package/themes/business/src/components/Chat/index.tsx +38 -30
  36. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  37. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  38. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  39. package/themes/business/src/components/MapView/index.tsx +12 -1
  40. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  41. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  42. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  43. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  44. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  45. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  46. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  47. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  49. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  50. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  52. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  54. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  55. package/themes/business/src/components/PreviousOrders/index.tsx +22 -24
  56. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  57. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  58. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  59. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  60. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  61. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  62. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  63. package/themes/business/src/types/index.tsx +15 -9
  64. package/themes/business/src/utils/index.tsx +10 -0
  65. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  67. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  68. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  69. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  70. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  71. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  72. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  73. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  74. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  76. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  77. package/themes/kiosk/src/types/index.d.ts +2 -0
  78. package/themes/original/index.tsx +4 -0
  79. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  80. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  81. package/themes/original/src/components/AddressList/index.tsx +1 -1
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +324 -162
  84. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  85. package/themes/original/src/components/BusinessController/index.tsx +216 -113
  86. package/themes/original/src/components/BusinessController/styles.tsx +1 -8
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +109 -139
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  94. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  96. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -104
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  99. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  100. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  102. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +279 -104
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  105. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  106. package/themes/original/src/components/Cart/index.tsx +54 -16
  107. package/themes/original/src/components/Cart/styles.tsx +4 -0
  108. package/themes/original/src/components/CartContent/index.tsx +22 -16
  109. package/themes/original/src/components/Checkout/index.tsx +110 -116
  110. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  111. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  112. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  113. package/themes/original/src/components/Favorite/index.tsx +1 -0
  114. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  119. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  120. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  121. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  122. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  123. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  124. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -73
  125. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  126. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  127. package/themes/original/src/components/Messages/index.tsx +17 -17
  128. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  129. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  130. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  132. package/themes/original/src/components/MyOrders/index.tsx +88 -22
  133. package/themes/original/src/components/NavBar/index.tsx +15 -9
  134. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  135. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  136. package/themes/original/src/components/Notifications/index.tsx +148 -0
  137. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  138. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  139. package/themes/original/src/components/OrderDetails/index.tsx +200 -37
  140. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  141. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  142. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  143. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  144. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  145. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  146. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  147. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  148. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +97 -106
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  150. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  151. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  152. package/themes/original/src/components/PaymentOptions/index.tsx +41 -23
  153. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  154. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  155. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  156. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  157. package/themes/original/src/components/ProductForm/index.tsx +635 -664
  158. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  159. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  160. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  161. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  162. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  163. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  164. package/themes/original/src/components/ProfessionalProfile/index.tsx +26 -14
  165. package/themes/original/src/components/Promotions/index.tsx +232 -219
  166. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  167. package/themes/original/src/components/ReviewDriver/index.tsx +7 -7
  168. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  169. package/themes/original/src/components/ReviewProducts/index.tsx +2 -2
  170. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  171. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  172. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  173. package/themes/original/src/components/ServiceForm/index.tsx +410 -258
  174. package/themes/original/src/components/SignupForm/index.tsx +184 -127
  175. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  176. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  177. package/themes/original/src/components/SingleProductCard/index.tsx +198 -112
  178. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  179. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  180. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +18 -7
  182. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  183. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  184. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  185. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  186. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  187. package/themes/original/src/components/UserProfileForm/index.tsx +10 -10
  188. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  189. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  190. package/themes/original/src/components/Wallets/index.tsx +176 -164
  191. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  192. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  193. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  194. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  195. package/themes/original/src/components/shared/OButton.tsx +10 -3
  196. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  197. package/themes/original/src/components/shared/OInput.tsx +13 -3
  198. package/themes/original/src/layouts/Container.tsx +13 -9
  199. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  200. package/themes/original/src/types/index.tsx +82 -29
  201. package/themes/original/src/utils/index.tsx +121 -10
  202. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect, useRef } from 'react'
2
2
  import { useTheme } from 'styled-components/native'
3
- import { Platform, View, StyleSheet, Dimensions } from 'react-native'
4
- import { OText, OButton } from '../shared'
3
+ import { Platform, View, StyleSheet, Dimensions, ScrollView, TouchableOpacity } from 'react-native'
4
+ import { OText, OButton, OModal, OIcon } from '../shared'
5
5
  import FastImage from 'react-native-fast-image'
6
6
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
7
7
  import SelectDropdown from 'react-native-select-dropdown'
@@ -10,6 +10,8 @@ import CalendarPicker from 'react-native-calendar-picker'
10
10
  import FeatherIcon from 'react-native-vector-icons/Feather';
11
11
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
12
12
  import { ServiceFormParams } from '../../types'
13
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
14
+
13
15
  import {
14
16
  ProductForm as ProductFormController,
15
17
  useUtils,
@@ -35,13 +37,15 @@ const screenWidth = Dimensions.get('window').width
35
37
  const ServiceFormUI = (props: ServiceFormParams) => {
36
38
  const {
37
39
  professionalSelected,
38
- product,
40
+ productObject,
39
41
  handleSave,
40
42
  productCart,
41
43
  navigation,
42
44
  isSoldOut,
43
45
  maxProductQuantity,
44
- onClose
46
+ onClose,
47
+ professionalListState,
48
+ isCartProduct
45
49
  } = props
46
50
 
47
51
  const theme = useTheme()
@@ -51,19 +55,22 @@ const ServiceFormUI = (props: ServiceFormParams) => {
51
55
  const [{ configs }] = useConfig()
52
56
  const [orderState] = useOrder()
53
57
  const [{ auth }] = useSession()
58
+ const { product, loading, error } = productObject;
54
59
 
55
60
  const [selectDate, setSelectedDate] = useState<any>(new Date())
56
61
  const [timeList, setTimeList] = useState<any>([])
57
62
  const [isEnabled, setIsEnabled] = useState(false)
58
- const [timeSelected, setTimeSelected] = useState(null)
63
+ const [timeSelected, setTimeSelected] = useState<string | null>(null)
59
64
  const [dateSelected, setDateSelected] = useState<any>(null)
65
+ const [isOpen, setIsOpen] = useState(false)
66
+ const [currentProfessional, setCurrentProfessional] = useState<any>(null)
60
67
 
61
68
  const dropdownRef = useRef<any>(null)
62
69
 
63
70
  const styles = StyleSheet.create({
64
71
  photoStyle: {
65
- width: 42,
66
- height: 42,
72
+ width: 45,
73
+ height: 45,
67
74
  borderRadius: 7.6
68
75
  },
69
76
  buttonStyle: {
@@ -75,7 +82,15 @@ const ServiceFormUI = (props: ServiceFormParams) => {
75
82
  borderRadius: 7.6,
76
83
  padding: 11,
77
84
  borderWidth: 1,
78
- borderColor: theme.colors.backgroundGray200
85
+ borderColor: theme.colors.backgroundGray200,
86
+ flexDirection: 'row',
87
+ alignItems: 'center',
88
+ justifyContent: 'space-between'
89
+ },
90
+ professionalItem: {
91
+ paddingVertical: 11,
92
+ borderColor: theme.colors.backgroundGray200,
93
+ borderTopWidth: 1
79
94
  },
80
95
  selectOption: {
81
96
  width: '100%',
@@ -87,12 +102,16 @@ const ServiceFormUI = (props: ServiceFormParams) => {
87
102
  justifyContent: 'space-between',
88
103
  height: 40,
89
104
  marginBottom: 30
105
+ },
106
+ professionalList: {
107
+ paddingHorizontal: 40,
108
+ paddingVertical: 30
90
109
  }
91
110
  })
92
111
 
93
- const isBusyTime = () => {
94
- if (professionalSelected?.busy_times?.length === 0 || !dateSelected) return false
95
- const valid = professionalSelected?.busy_times.some((item: any) => {
112
+ const isBusyTime = (professional: any) => {
113
+ if (professional?.busy_times?.length === 0 || !dateSelected) return false
114
+ const valid = professional?.busy_times.some((item: any) => {
96
115
  return moment(item?.start).valueOf() <= moment(dateSelected).valueOf() &&
97
116
  moment(dateSelected).valueOf() <= moment(item?.end).valueOf()
98
117
  })
@@ -102,7 +121,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
102
121
  const onDateChange = (date: any) => {
103
122
  setSelectedDate(date)
104
123
  setTimeSelected(null)
105
- dropdownRef.current.reset()
124
+ dropdownRef?.current && dropdownRef.current.reset()
106
125
  }
107
126
 
108
127
  const dropDownIcon = () => {
@@ -125,7 +144,10 @@ const ServiceFormUI = (props: ServiceFormParams) => {
125
144
  };
126
145
 
127
146
  const handleSaveService = () => {
128
- const updated = { serviceTime: dateSelected }
147
+ const updated = {
148
+ serviceTime: moment(dateSelected).utc().format('YYYY-MM-DD HH:mm:00'),
149
+ professional: currentProfessional
150
+ }
129
151
  handleSave && handleSave(updated)
130
152
  }
131
153
 
@@ -135,7 +157,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
135
157
  }
136
158
 
137
159
  const handleRedirectLogin = () => {
138
- navigation.navigate('Login', {
160
+ navigation && navigation.navigate('Login', {
139
161
  store_slug: props.businessSlug
140
162
  });
141
163
  onClose && onClose()
@@ -191,15 +213,20 @@ const ServiceFormUI = (props: ServiceFormParams) => {
191
213
  }
192
214
 
193
215
  const addressRedirect = () => {
194
- navigation.navigate('AddressList')
216
+ navigation && navigation.navigate('AddressList')
195
217
  onClose && onClose()
196
218
  }
197
219
 
220
+ const handleChangeProfessional = (professional: any) => {
221
+ setCurrentProfessional(professional)
222
+ setIsOpen(false)
223
+ }
224
+
198
225
  useEffect(() => {
199
- if (selectDate === null) return
200
- const _times = getTimes(selectDate, professionalSelected)
226
+ if (selectDate === null || currentProfessional === null) return
227
+ const _times = getTimes(selectDate, currentProfessional)
201
228
  setTimeList(_times)
202
- }, [selectDate, professionalSelected])
229
+ }, [selectDate, currentProfessional])
203
230
 
204
231
  useEffect(() => {
205
232
  if (!selectDate || !timeSelected) {
@@ -209,269 +236,394 @@ const ServiceFormUI = (props: ServiceFormParams) => {
209
236
  const date = `${moment(selectDate).format('YYYY-MM-DD')} ${timeSelected}:00`
210
237
  setDateSelected(date)
211
238
  }, [selectDate, timeSelected])
239
+
240
+ useEffect(() => {
241
+ if (!professionalSelected?.schedule) return
242
+ setCurrentProfessional(professionalSelected)
243
+ }, [professionalSelected])
244
+
245
+ useEffect(() => {
246
+ if (isCartProduct && professionalListState?.professionals?.length > 0) {
247
+ const professional = professionalListState?.professionals?.find((item: any) => item.id === professionalSelected?.id)
248
+ setCurrentProfessional(professional)
249
+ }
250
+ }, [isCartProduct, professionalListState?.professionals])
251
+
252
+ useEffect(() => {
253
+ if (!productCart?.calendar_event?.start) return
254
+ setSelectedDate(moment.utc(productCart?.calendar_event?.start).local())
255
+ setTimeSelected(moment.utc(productCart?.calendar_event?.start).local().format('HH:mm'))
256
+ }, [productCart])
212
257
 
213
258
  return (
214
- <Container>
215
- <ProfessionalPhoto
216
- source={{
217
- uri:
218
- product?.images ||
219
- optimizeImage(theme?.images?.dummies?.product, 'h_250,c_limit'),
220
- }}
221
- />
222
- <InfoWrapper>
223
- <OText
224
- size={20}
225
- style={{ marginBottom: 4 }}
226
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
227
- >
228
- {product?.name}
229
- </OText>
230
- <OText
231
- size={16}
232
- style={{ marginBottom: 10 }}
233
- weight={'400'}
234
- >
235
- {parsePrice(product?.price)} • {product?.duration}min
236
- </OText>
237
- <OText
238
- size={14}
239
- weight={'400'}
240
- color={theme?.colors?.disabled}
241
- >
242
- {product?.description}
243
- </OText>
244
- </InfoWrapper>
245
- <Divider />
246
- <ProfessionalWrapper>
247
- <View
248
- style={{
249
- flexDirection: 'row',
250
- justifyContent: 'space-between',
251
- alignItems: 'center',
252
- marginBottom: 23
253
- }}
254
- >
255
- <OText
256
- size={16}
257
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
258
- >
259
- {t('PROFESSIONAL', 'Proffesional')}
260
- </OText>
261
- <OText
262
- size={10}
263
- weight={'400'}
264
- color={theme.colors?.danger5}
265
- >
266
- {t('REQUIRED', 'Required')}
267
- </OText>
268
- </View>
269
- <View
270
- style={styles.professionalSelect}
271
- >
272
- <View style={{ flexDirection: 'row' }}>
273
- <FastImage
274
- style={styles.photoStyle}
259
+ <>
260
+ {loading && !error && (
261
+ <Placeholder Animation={Fade}>
262
+ <PlaceholderLine
263
+ height={258}
264
+ style={{ borderRadius: 0 }}
265
+ width={screenWidth}
266
+ />
267
+ </Placeholder>
268
+ )}
269
+ {!loading && !error && (
270
+ <Container>
271
+ {!!product?.images ? (
272
+ <ProfessionalPhoto
275
273
  source={{
276
- uri: optimizeImage(professionalSelected?.photo, 'h_250,c_limit'),
277
- priority: FastImage.priority.normal,
274
+ uri: product?.images
278
275
  }}
279
- resizeMode={FastImage.resizeMode.cover}
280
276
  />
281
- <View style={{ marginLeft: 14 }}>
277
+ ) : (
278
+ <OIcon
279
+ src={theme?.images?.dummies?.product}
280
+ cover={false}
281
+ style={{ alignSelf: 'center' }}
282
+ width={200}
283
+ height={200}
284
+ />
285
+ )}
286
+ <InfoWrapper>
287
+ <OText
288
+ size={20}
289
+ style={{ marginBottom: 4 }}
290
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
291
+ >
292
+ {product?.name}
293
+ </OText>
294
+ <OText
295
+ size={16}
296
+ style={{ marginBottom: 10 }}
297
+ weight={'400'}
298
+ >
299
+ {parsePrice(product?.price)} • {product?.duration}min
300
+ </OText>
301
+ <OText
302
+ size={14}
303
+ weight={'400'}
304
+ color={theme?.colors?.disabled}
305
+ >
306
+ {product?.description}
307
+ </OText>
308
+ </InfoWrapper>
309
+ <Divider />
310
+ <ProfessionalWrapper>
311
+ <View
312
+ style={{
313
+ flexDirection: 'row',
314
+ justifyContent: 'space-between',
315
+ alignItems: 'center',
316
+ marginBottom: 23
317
+ }}
318
+ >
319
+ <OText
320
+ size={16}
321
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
322
+ >
323
+ {t('PROFESSIONAL', 'Professional')}
324
+ </OText>
282
325
  <OText
283
- size={14}
326
+ size={10}
284
327
  weight={'400'}
328
+ color={theme.colors?.danger5}
285
329
  >
286
- {professionalSelected?.name} {professionalSelected?.lastname}
330
+ {t('REQUIRED', 'Required')}
331
+ </OText>
332
+ </View>
333
+ <TouchableOpacity
334
+ style={styles.professionalSelect}
335
+ onPress={() => setIsOpen(true)}
336
+ >
337
+ {!!currentProfessional ? (
338
+ <>
339
+ <View style={{ flexDirection: 'row' }}>
340
+ {!!currentProfessional?.photo ? (
341
+ <FastImage
342
+ style={styles.photoStyle}
343
+ source={{
344
+ uri: optimizeImage(currentProfessional?.photo, 'h_250,c_limit'),
345
+ priority: FastImage.priority.normal,
346
+ }}
347
+ resizeMode={FastImage.resizeMode.cover}
348
+ />
349
+ ) : (
350
+ <OIcon
351
+ src={theme?.images?.general?.user}
352
+ cover={false}
353
+ style={styles.photoStyle}
354
+ />
355
+ )}
356
+ <View style={{ marginLeft: 14 }}>
357
+ <OText
358
+ size={14}
359
+ weight={'400'}
360
+ lineHeight={22}
361
+ >
362
+ {currentProfessional?.name} {currentProfessional?.lastname}
363
+ </OText>
364
+ <OText
365
+ size={12}
366
+ weight={'400'}
367
+ lineHeight={17}
368
+ color={isBusyTime(currentProfessional) ? theme.colors.danger5 : theme.colors.success500}
369
+ >
370
+ {isBusyTime(currentProfessional)
371
+ ? t('BUSY_ON_SELECTED_TIME', 'Busy on selected time')
372
+ : t('AVAILABLE', 'Available')
373
+ }
374
+ </OText>
375
+ </View>
376
+ </View>
377
+ </>
378
+ ) : (
379
+ <OText size={12}>{t('SELECT_PROFESSIONAL', 'Select professional')}</OText>
380
+ )}
381
+ <View style={{ marginLeft: 5 }}>
382
+ <IconAntDesign
383
+ name='down'
384
+ color={theme.colors.textThird}
385
+ size={12}
386
+ />
387
+ </View>
388
+ </TouchableOpacity>
389
+ </ProfessionalWrapper>
390
+ <ScheduleWrapper>
391
+ <View
392
+ style={{
393
+ flexDirection: 'row',
394
+ justifyContent: 'space-between',
395
+ alignItems: 'center',
396
+ marginBottom: 23
397
+ }}
398
+ >
399
+ <OText
400
+ size={16}
401
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
402
+ >
403
+ {t('SCHEDULE', 'Schedule')}
287
404
  </OText>
288
405
  <OText
289
- size={12}
406
+ size={10}
290
407
  weight={'400'}
291
- color={isBusyTime() ? theme.colors.danger5 : theme.colors.success500}
408
+ color={theme.colors?.danger5}
292
409
  >
293
- {isBusyTime()
294
- ? t('BUSY_ON_SELECTED_TIME', 'Busy on selected time')
295
- : t('AVAILABLE', 'Available')
296
- }
410
+ {t('REQUIRED', 'Required')}
297
411
  </OText>
298
412
  </View>
299
- </View>
300
- </View>
301
- </ProfessionalWrapper>
302
- <ScheduleWrapper>
303
- <View
304
- style={{
305
- flexDirection: 'row',
306
- justifyContent: 'space-between',
307
- alignItems: 'center',
308
- marginBottom: 23
309
- }}
310
- >
311
- <OText
312
- size={16}
313
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
314
- >
315
- {t('SCHEDULE', 'Schedule')}
316
- </OText>
317
- <OText
318
- size={10}
319
- weight={'400'}
320
- color={theme.colors?.danger5}
321
- >
322
- {t('REQUIRED', 'Required')}
323
- </OText>
324
- </View>
325
- {(!!professionalSelected?.schedule && isEnabled) ? (
326
- <CalendarWrapper>
327
- {timeList?.length > 0 ? (
328
- <SelectDropdown
329
- ref={dropdownRef}
330
- defaultValue={timeSelected}
331
- data={timeList}
332
- onSelect={(selectedItem, index) => {
333
- setTimeSelected(selectedItem.value)
334
- }}
335
- buttonTextAfterSelection={(selectedItem, index) => {
336
- return selectedItem.text
337
- }}
338
- rowTextForSelection={(item, index) => {
339
- return item.text
340
- }}
341
- buttonStyle={{borderRadius: 7.6, ...styles.selectOption}}
342
- buttonTextStyle={{
343
- color: theme.colors.disabled,
344
- fontSize: 14,
345
- textAlign: 'left',
346
- marginHorizontal: 0
347
- }}
348
- dropdownStyle={{
349
- borderRadius: 8,
350
- borderColor: theme.colors.lightGray,
351
- marginTop: Platform.OS === 'ios' ? 12 : -top
352
- }}
353
- rowStyle={{
354
- borderBottomColor: theme.colors.backgroundGray100,
355
- backgroundColor: theme.colors.backgroundGray100,
356
- height: 30,
357
- flexDirection: 'column',
358
- alignItems: 'flex-start',
359
- paddingTop: 8,
360
- paddingHorizontal: 12
361
- }}
362
- rowTextStyle={{
363
- color: theme.colors.disabled,
364
- fontSize: 14,
365
- marginHorizontal: 0
366
- }}
367
- renderDropdownIcon={() => dropDownIcon()}
368
- dropdownOverlayColor='transparent'
369
- />
413
+ {!!currentProfessional?.schedule ? (
414
+ <CalendarWrapper>
415
+ {(timeList?.length > 0 && isEnabled) ? (
416
+ <SelectDropdown
417
+ ref={dropdownRef}
418
+ defaultValueByIndex={timeList.findIndex((item: any) => item.value === timeSelected)}
419
+ data={timeList}
420
+ onSelect={(selectedItem, index) => {
421
+ setTimeSelected(selectedItem?.value)
422
+ }}
423
+ buttonTextAfterSelection={(selectedItem, index) => {
424
+ return selectedItem?.text
425
+ }}
426
+ rowTextForSelection={(item, index) => {
427
+ return item.text
428
+ }}
429
+ buttonStyle={{borderRadius: 7.6, ...styles.selectOption}}
430
+ buttonTextStyle={{
431
+ color: theme.colors.disabled,
432
+ fontSize: 14,
433
+ textAlign: 'left',
434
+ marginHorizontal: 0
435
+ }}
436
+ dropdownStyle={{
437
+ borderRadius: 8,
438
+ borderColor: theme.colors.lightGray,
439
+ marginTop: Platform.OS === 'ios' ? 12 : -top
440
+ }}
441
+ rowStyle={{
442
+ borderBottomColor: theme.colors.backgroundGray100,
443
+ backgroundColor: theme.colors.backgroundGray100,
444
+ height: 30,
445
+ flexDirection: 'column',
446
+ alignItems: 'flex-start',
447
+ paddingTop: 8,
448
+ paddingHorizontal: 12
449
+ }}
450
+ rowTextStyle={{
451
+ color: theme.colors.disabled,
452
+ fontSize: 14,
453
+ marginHorizontal: 0
454
+ }}
455
+ renderDropdownIcon={() => dropDownIcon()}
456
+ dropdownOverlayColor='transparent'
457
+ />
458
+ ) : (
459
+ <OText
460
+ size={12}
461
+ style={{ marginBottom: 30 }}
462
+ weight={'400'}
463
+ color={theme.colors?.danger5}
464
+ >
465
+ {t('PROFESSIONAL_NOT_AVAILABLE', 'Professional is not available at the moment')}
466
+ </OText>
467
+ )}
468
+ <CalendarPicker
469
+ previousComponent={
470
+ <FeatherIcon
471
+ name='chevron-left'
472
+ color={theme.colors.disabled}
473
+ size={24}
474
+ style={{ marginHorizontal: 4 }}
475
+ />
476
+ }
477
+ nextComponent={
478
+ <FeatherIcon
479
+ name='chevron-right'
480
+ color={theme.colors.disabled}
481
+ size={24}
482
+ style={{ marginHorizontal: 4 }}
483
+ />
484
+ }
485
+ width={screenWidth - 110}
486
+ selectedDayTextColor={theme.colors.white}
487
+ selectedDayColor={theme.colors.primary}
488
+ todayBackgroundColor={theme.colors.border}
489
+ dayLabelsWrapper={{ borderColor: theme.colors.clear }}
490
+ onDateChange={onDateChange}
491
+ minDate={new Date()}
492
+ customDayHeaderStyles={customDayHeaderStylesCallback}
493
+ selectedStartDate={selectDate}
494
+ />
495
+ </CalendarWrapper>
370
496
  ) : (
371
497
  <OText
372
- size={20}
373
- style={{ marginBottom: 30 }}
498
+ size={16}
499
+ style={{ marginBottom: 30, textAlign: 'center' }}
500
+ color={theme?.colors?.disabled}
374
501
  weight={Platform.OS === 'ios' ? '600' : 'bold'}
375
502
  >
376
- {t('NOT_AVAILABLE', 'Not available')}
503
+ {t('NO_SCHEDULE', 'No schedule')}
377
504
  </OText>
378
505
  )}
379
-
380
- <CalendarPicker
381
- previousComponent={
382
- <FeatherIcon
383
- name='chevron-left'
384
- color={theme.colors.disabled}
385
- size={24}
386
- style={{ marginHorizontal: 4 }}
506
+ </ScheduleWrapper>
507
+ <ButtonWrapper>
508
+ <OText
509
+ size={14}
510
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
511
+ >
512
+ {dateSelected && moment(dateSelected).format('hh:mm A')}
513
+ </OText>
514
+ {((productCart &&
515
+ auth &&
516
+ orderState.options?.address_id)) && (
517
+ <OButton
518
+ bgColor={theme.colors.primary}
519
+ onClick={() => handleSaveService()}
520
+ text={orderState.loading
521
+ ? t('LOADING', 'Loading')
522
+ : ((isSoldOut || maxProductQuantity <= 0)
523
+ ? t('SOLD_OUT', 'Sold out')
524
+ : t('BOOK', 'Book'))}
525
+ style={styles.buttonStyle}
526
+ isDisabled={isSoldOut || maxProductQuantity <= 0 || !currentProfessional?.id || !dateSelected}
527
+ textStyle={{ fontSize: 14, color: theme.colors.white }}
387
528
  />
388
- }
389
- nextComponent={
390
- <FeatherIcon
391
- name='chevron-right'
392
- color={theme.colors.disabled}
393
- size={24}
394
- style={{ marginHorizontal: 4 }}
529
+ )}
530
+ {auth &&
531
+ !orderState.options?.address_id &&
532
+ (orderState.loading ? (
533
+ <OButton
534
+ isDisabled
535
+ text={t('LOADING', 'Loading')}
536
+ imgRightSrc=""
537
+ textStyle={{ fontSize: 10 }}
395
538
  />
396
- }
397
- width={screenWidth - 110}
398
- selectedDayTextColor={theme.colors.white}
399
- selectedDayColor={theme.colors.primary}
400
- todayBackgroundColor={theme.colors.border}
401
- dayLabelsWrapper={{ borderColor: theme.colors.clear }}
402
- onDateChange={onDateChange}
403
- minDate={new Date()}
404
- customDayHeaderStyles={customDayHeaderStylesCallback}
405
- selectedStartDate={selectDate}
406
- />
407
- </CalendarWrapper>
408
- ) : (
409
- <OText
410
- size={20}
411
- style={{ marginBottom: 30 }}
412
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
413
- >
414
- {t('NO_SCHEDULE', 'No schedule')}
415
- </OText>
416
- )}
417
- </ScheduleWrapper>
418
- <ButtonWrapper>
419
- <OText
420
- size={14}
421
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
422
- >
423
- {dateSelected
424
- ? moment(dateSelected).format('hh:mm A')
425
- : t('ASAP_ABBREVIATION', 'ASAP')}
426
- </OText>
427
- {((productCart &&
428
- auth &&
429
- orderState.options?.address_id)) && (
430
- <OButton
431
- bgColor={theme.colors.primary}
432
- onClick={() => handleSaveService()}
433
- text={orderState.loading
434
- ? t('LOADING', 'Loading')
435
- : ((isSoldOut || maxProductQuantity <= 0)
436
- ? t('SOLD_OUT', 'Sold out')
437
- : t('BOOK', 'Book'))}
438
- style={styles.buttonStyle}
439
- isDisabled={isSoldOut || maxProductQuantity <= 0 || !professionalSelected?.id || !dateSelected}
440
- textStyle={{ fontSize: 14, color: theme.colors.white }}
441
- />
442
- )}
443
- {auth &&
444
- !orderState.options?.address_id &&
445
- (orderState.loading ? (
446
- <OButton
447
- isDisabled
448
- text={t('LOADING', 'Loading')}
449
- imgRightSrc=""
450
- textStyle={{ fontSize: 10 }}
451
- />
452
- ) : (
453
- <OButton onClick={() => addressRedirect()} />
539
+ ) : (
540
+ <OButton onClick={() => addressRedirect()} />
541
+ ))}
542
+ {!auth && (
543
+ <OButton
544
+ isDisabled={isSoldOut || maxProductQuantity <= 0}
545
+ onClick={() => handleRedirectLogin()}
546
+ text={
547
+ isSoldOut || maxProductQuantity <= 0
548
+ ? t('SOLD_OUT', 'Sold out')
549
+ : t('LOGIN_SIGNUP', 'Login / Sign Up')
550
+ }
551
+ imgRightSrc=""
552
+ textStyle={{ color: theme.colors.primary, fontSize: 14 }}
553
+ style={{
554
+ height: 44,
555
+ borderColor: theme.colors.primary,
556
+ backgroundColor: theme.colors.white,
557
+ }}
558
+ />
559
+ )}
560
+ </ButtonWrapper>
561
+ </Container>
562
+ )}
563
+
564
+ <OModal
565
+ open={isOpen}
566
+ onClose={() => setIsOpen(false)}
567
+ entireModal
568
+ >
569
+ <ScrollView contentContainerStyle={styles.professionalList}>
570
+ <View style={{ paddingVertical: 11 }}>
571
+ <OText
572
+ size={14}
573
+ weight={'400'}
574
+ >
575
+ {t('ANY_OROFESSIONAL_MEMBER', 'Any professional member')}
576
+ </OText>
577
+ </View>
578
+ {professionalListState?.professionals?.map((professional: any) => (
579
+ <TouchableOpacity
580
+ key={professional?.id}
581
+ style={styles.professionalItem}
582
+ onPress={() => handleChangeProfessional(professional)}
583
+ >
584
+ <View style={{ flexDirection: 'row' }}>
585
+ {!!professional?.photo ? (
586
+ <FastImage
587
+ style={styles.photoStyle}
588
+ source={{
589
+ uri: optimizeImage(professional?.photo, 'h_250,c_limit'),
590
+ priority: FastImage.priority.normal,
591
+ }}
592
+ resizeMode={FastImage.resizeMode.cover}
593
+ />
594
+ ) : (
595
+ <OIcon
596
+ src={theme?.images?.general?.user}
597
+ cover={false}
598
+ style={styles.photoStyle}
599
+ />
600
+ )}
601
+ <View style={{ marginLeft: 14 }}>
602
+ <OText
603
+ size={14}
604
+ weight={'400'}
605
+ lineHeight={22}
606
+ >
607
+ {professional?.name} {professional?.lastname}
608
+ </OText>
609
+ <OText
610
+ size={12}
611
+ weight={'400'}
612
+ lineHeight={17}
613
+ color={isBusyTime(professional) ? theme.colors.danger5 : theme.colors.success500}
614
+ >
615
+ {isBusyTime(professional)
616
+ ? t('BUSY_ON_SELECTED_TIME', 'Busy on selected time')
617
+ : t('AVAILABLE', 'Available')
618
+ }
619
+ </OText>
620
+ </View>
621
+ </View>
622
+ </TouchableOpacity>
454
623
  ))}
455
- {!auth && (
456
- <OButton
457
- isDisabled={isSoldOut || maxProductQuantity <= 0}
458
- onClick={() => handleRedirectLogin()}
459
- text={
460
- isSoldOut || maxProductQuantity <= 0
461
- ? t('SOLD_OUT', 'Sold out')
462
- : t('LOGIN_SIGNUP', 'Login / Sign Up')
463
- }
464
- imgRightSrc=""
465
- textStyle={{ color: theme.colors.primary, fontSize: 14 }}
466
- style={{
467
- height: 44,
468
- borderColor: theme.colors.primary,
469
- backgroundColor: theme.colors.white,
470
- }}
471
- />
472
- )}
473
- </ButtonWrapper>
474
- </Container>
624
+ </ScrollView>
625
+ </OModal>
626
+ </>
475
627
  )
476
628
  }
477
629