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