ordering-ui-react-native 0.14.84 → 0.14.86-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.
- package/package.json +6 -3
- package/src/DeliveryApp.tsx +34 -2
- package/src/assets/images/no-network.png +0 -0
- package/src/components/BusinessTypeFilter/index.tsx +9 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Cart/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/Home/index.tsx +3 -5
- package/src/components/LanguageSelector/index.tsx +65 -97
- package/src/components/LanguageSelector/styles.tsx +4 -17
- package/src/components/Messages/index.tsx +38 -30
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +29 -6
- package/src/components/OrdersOption/index.tsx +4 -2
- package/src/components/PaymentOptions/index.tsx +7 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +35 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/providers/AlertProvider.tsx +4 -1
- package/src/theme.json +2 -1
- package/src/types/index.tsx +2 -9
- package/src/utils/index.tsx +196 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/Chat/index.tsx +32 -31
- package/themes/business/src/components/NetworkError/index.tsx +61 -0
- package/themes/business/src/components/NetworkError/styles.tsx +11 -0
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- package/themes/business/src/components/OrdersListManager/index.tsx +871 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +354 -54
- package/themes/business/src/components/OrdersOption/styles.tsx +95 -7
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +65 -46
- package/themes/business/src/components/PreviousOrders/styles.tsx +5 -10
- package/themes/business/src/components/ReviewCustomer/index.tsx +11 -8
- package/themes/business/src/types/index.tsx +4 -0
- package/themes/business/src/utils/index.tsx +12 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/doordash/src/components/OrderDetails/index.tsx +3 -1
- package/themes/doordash/src/components/OrdersOption/index.tsx +4 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/instacart/src/components/OrderDetails/index.tsx +3 -1
- package/themes/instacart/src/components/OrdersOption/index.tsx +4 -2
- package/themes/kiosk/index.tsx +2 -0
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/NetworkError/index.tsx +60 -0
- package/themes/kiosk/src/components/NetworkError/styles.tsx +11 -0
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/kiosk/src/types/index.d.ts +4 -0
- package/themes/original/index.tsx +26 -6
- package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +11 -7
- package/themes/original/src/components/BusinessController/index.tsx +3 -3
- package/themes/original/src/components/BusinessMenuList/index.tsx +4 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -121
- package/themes/original/src/components/BusinessProductsList/index.tsx +50 -6
- package/themes/original/src/components/BusinessProductsListing/index.tsx +13 -10
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
- package/themes/original/src/components/BusinessesListing/index.tsx +23 -22
- package/themes/original/src/components/Cart/index.tsx +43 -10
- package/themes/original/src/components/Checkout/index.tsx +54 -17
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +9 -2
- package/themes/original/src/components/LastOrder/index.tsx +3 -1
- package/themes/original/src/components/LoginForm/index.tsx +83 -68
- package/themes/original/src/components/MessageListing/index.tsx +4 -2
- package/themes/original/src/components/Messages/index.tsx +19 -21
- package/themes/original/src/components/MomentOption/index.tsx +127 -152
- package/themes/original/src/components/MomentOption/styles.tsx +42 -18
- package/themes/original/src/components/NetworkError/index.tsx +61 -0
- package/themes/original/src/components/NetworkError/styles.tsx +11 -0
- package/themes/original/src/components/OrderDetails/index.tsx +106 -113
- package/themes/original/src/components/OrderProgress/index.tsx +6 -5
- package/themes/original/src/components/OrderSummary/index.tsx +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +20 -42
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +20 -23
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +4 -0
- package/themes/original/src/components/ProductForm/index.tsx +35 -20
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +81 -74
- package/themes/original/src/components/ReviewDriver/index.tsx +315 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +38 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +307 -186
- package/themes/original/src/components/ReviewOrder/styles.tsx +24 -13
- package/themes/original/src/components/ReviewProducts/index.tsx +116 -0
- package/themes/original/src/components/ReviewProducts/styles.tsx +16 -0
- package/themes/original/src/components/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/SingleProductCard/index.tsx +6 -13
- package/themes/original/src/components/SingleProductCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductReview/index.tsx +166 -0
- package/themes/original/src/components/SingleProductReview/styles.tsx +27 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +13 -6
- package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +26 -0
- package/themes/original/src/types/index.tsx +47 -10
- package/themes/single-business/src/components/LastOrder/index.tsx +3 -1
- package/themes/single-business/src/components/OrderDetails/index.tsx +15 -0
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- package/themes/single-business/src/components/OrdersOption/index.tsx +4 -2
- package/themes/single-business/src/utils/index.tsx +7 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/uber-eats/src/components/OrderDetails/index.tsx +3 -1
- package/themes/uber-eats/src/components/OrdersOption/index.tsx +4 -2
- package/src/components/StripeMethodForm/index.tsx +0 -163
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
TimeContentWrapper,
|
|
22
22
|
TimeItem
|
|
23
23
|
} from './styles'
|
|
24
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
24
25
|
|
|
25
26
|
const windowHeight = Dimensions.get('window').height;
|
|
26
27
|
|
|
@@ -50,7 +51,9 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
50
51
|
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
51
52
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
52
53
|
const [isEnabled, setIsEnabled] = useState(false)
|
|
53
|
-
|
|
54
|
+
const { top } = useSafeAreaInsets()
|
|
55
|
+
const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
|
|
56
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
54
57
|
const styles = StyleSheet.create({
|
|
55
58
|
container: {
|
|
56
59
|
height: windowHeight,
|
|
@@ -299,60 +302,62 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
299
302
|
/>
|
|
300
303
|
</View>
|
|
301
304
|
</BusinessInfoWrapper>
|
|
302
|
-
|
|
303
|
-
<
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
305
|
+
{isPreOrderSetting && (
|
|
306
|
+
<PreorderTypeWrapper>
|
|
307
|
+
<OText
|
|
308
|
+
size={16}
|
|
309
|
+
style={{
|
|
310
|
+
fontWeight: '600',
|
|
311
|
+
lineHeight: 24,
|
|
312
|
+
marginBottom: 12
|
|
313
|
+
}}
|
|
314
|
+
>
|
|
315
|
+
{t('PREORDER_TYPE', 'Preorder type')}
|
|
316
|
+
</OText>
|
|
317
|
+
<SelectDropdown
|
|
318
|
+
defaultValueByIndex={selectedPreorderType}
|
|
319
|
+
data={preorderTypeList}
|
|
320
|
+
// disabled={orderState.loading}
|
|
321
|
+
onSelect={(selectedItem, index) => {
|
|
322
|
+
setSelectedPreorderType(index)
|
|
323
|
+
}}
|
|
324
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
325
|
+
return selectedItem.name
|
|
326
|
+
}}
|
|
327
|
+
rowTextForSelection={(item, index) => {
|
|
328
|
+
return item.name
|
|
329
|
+
}}
|
|
330
|
+
buttonStyle={styles.selectOption}
|
|
331
|
+
buttonTextStyle={{
|
|
332
|
+
color: theme.colors.disabled,
|
|
333
|
+
fontSize: 14,
|
|
334
|
+
textAlign: 'left',
|
|
335
|
+
marginHorizontal: 0
|
|
336
|
+
}}
|
|
337
|
+
dropdownStyle={{
|
|
338
|
+
borderRadius: 8,
|
|
339
|
+
borderColor: theme.colors.lightGray,
|
|
340
|
+
marginTop: Platform.OS === 'ios' ? 12 : -top
|
|
341
|
+
}}
|
|
342
|
+
rowStyle={{
|
|
343
|
+
borderBottomColor: theme.colors.backgroundGray100,
|
|
344
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
345
|
+
height: 40,
|
|
346
|
+
flexDirection: 'column',
|
|
347
|
+
alignItems: 'flex-start',
|
|
348
|
+
paddingTop: 8,
|
|
349
|
+
paddingHorizontal: 14
|
|
350
|
+
}}
|
|
351
|
+
rowTextStyle={{
|
|
352
|
+
color: theme.colors.disabled,
|
|
353
|
+
fontSize: 14,
|
|
354
|
+
marginHorizontal: 0
|
|
355
|
+
}}
|
|
356
|
+
renderDropdownIcon={() => dropDownIcon()}
|
|
357
|
+
dropdownOverlayColor='transparent'
|
|
358
|
+
/>
|
|
359
|
+
</PreorderTypeWrapper>
|
|
360
|
+
)}
|
|
356
361
|
{selectedPreorderType === 1 && (
|
|
357
362
|
<MenuWrapper>
|
|
358
363
|
<OText
|
|
@@ -372,78 +377,94 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
372
377
|
/>
|
|
373
378
|
</MenuWrapper>
|
|
374
379
|
)}
|
|
375
|
-
|
|
380
|
+
{isPreOrderSetting && (
|
|
381
|
+
<OrderTimeWrapper>
|
|
382
|
+
<OText
|
|
383
|
+
size={16}
|
|
384
|
+
style={{
|
|
385
|
+
fontWeight: '600',
|
|
386
|
+
lineHeight: 24
|
|
387
|
+
}}
|
|
388
|
+
>
|
|
389
|
+
{t('ORDER_TIME', 'Order time')}
|
|
390
|
+
</OText>
|
|
391
|
+
<View style={{ flex: 1 }}>
|
|
392
|
+
{selectDate && datesWhitelist[0]?.start !== null && (
|
|
393
|
+
<CalendarStrip
|
|
394
|
+
scrollable
|
|
395
|
+
style={styles.calendar}
|
|
396
|
+
calendarHeaderContainerStyle={styles.calendarHeaderContainer}
|
|
397
|
+
calendarHeaderStyle={styles.calendarHeader}
|
|
398
|
+
dateNumberStyle={styles.dateNumber}
|
|
399
|
+
dateNameStyle={styles.dateName}
|
|
400
|
+
iconContainer={{ flex: 0.1 }}
|
|
401
|
+
highlightDateNameStyle={styles.highlightDateName}
|
|
402
|
+
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
403
|
+
dayContainerStyle={{ height: '100%' }}
|
|
404
|
+
highlightDateContainerStyle={{ height: '100%' }}
|
|
405
|
+
calendarHeaderFormat='MMMM, YYYY'
|
|
406
|
+
iconStyle={{ borderWidth: 1 }}
|
|
407
|
+
selectedDate={selectDate}
|
|
408
|
+
datesWhitelist={datesWhitelist}
|
|
409
|
+
disabledDateNameStyle={styles.disabledDateName}
|
|
410
|
+
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
411
|
+
disabledDateOpacity={0.6}
|
|
412
|
+
onDateSelected={(date) => onSelectDate(date)}
|
|
413
|
+
leftSelector={<LeftSelector />}
|
|
414
|
+
rightSelector={<RightSelector />}
|
|
415
|
+
/>
|
|
416
|
+
)}
|
|
417
|
+
</View>
|
|
418
|
+
<TimeListWrapper nestedScrollEnabled={true}>
|
|
419
|
+
{(isEnabled && timeList?.length > 0) ? (
|
|
420
|
+
<TimeContentWrapper>
|
|
421
|
+
{timeList.map((time: any, i: number) => (
|
|
422
|
+
<TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
|
|
423
|
+
<TimeItem active={timeSelected === time.value}>
|
|
424
|
+
<OText
|
|
425
|
+
size={14}
|
|
426
|
+
color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
427
|
+
style={{
|
|
428
|
+
lineHeight: 24
|
|
429
|
+
}}
|
|
430
|
+
>{time.text}</OText>
|
|
431
|
+
</TimeItem>
|
|
432
|
+
</TouchableOpacity>
|
|
433
|
+
))}
|
|
434
|
+
{timeList.length % 3 === 2 && (
|
|
435
|
+
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
436
|
+
)}
|
|
437
|
+
</TimeContentWrapper>
|
|
438
|
+
) : (
|
|
439
|
+
<OText
|
|
440
|
+
size={16}
|
|
441
|
+
style={{
|
|
442
|
+
fontWeight: '600',
|
|
443
|
+
lineHeight: 24,
|
|
444
|
+
marginBottom: 12,
|
|
445
|
+
textAlign: 'center'
|
|
446
|
+
}}
|
|
447
|
+
>
|
|
448
|
+
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
449
|
+
</OText>
|
|
450
|
+
)}
|
|
451
|
+
</TimeListWrapper>
|
|
452
|
+
</OrderTimeWrapper>
|
|
453
|
+
)}
|
|
454
|
+
{!isPreOrderSetting && (
|
|
376
455
|
<OText
|
|
377
456
|
size={16}
|
|
378
457
|
style={{
|
|
379
458
|
fontWeight: '600',
|
|
380
|
-
lineHeight: 24
|
|
459
|
+
lineHeight: 24,
|
|
460
|
+
marginTop: 30,
|
|
461
|
+
marginBottom: 12,
|
|
462
|
+
textAlign: 'center'
|
|
381
463
|
}}
|
|
382
|
-
|
|
383
|
-
{t('
|
|
464
|
+
>
|
|
465
|
+
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
384
466
|
</OText>
|
|
385
|
-
|
|
386
|
-
{selectDate && datesWhitelist[0]?.start !== null && (
|
|
387
|
-
<CalendarStrip
|
|
388
|
-
scrollable
|
|
389
|
-
style={styles.calendar}
|
|
390
|
-
calendarHeaderContainerStyle={styles.calendarHeaderContainer}
|
|
391
|
-
calendarHeaderStyle={styles.calendarHeader}
|
|
392
|
-
dateNumberStyle={styles.dateNumber}
|
|
393
|
-
dateNameStyle={styles.dateName}
|
|
394
|
-
iconContainer={{ flex: 0.1 }}
|
|
395
|
-
highlightDateNameStyle={styles.highlightDateName}
|
|
396
|
-
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
397
|
-
dayContainerStyle={{ height: '100%' }}
|
|
398
|
-
highlightDateContainerStyle={{ height: '100%' }}
|
|
399
|
-
calendarHeaderFormat='MMMM, YYYY'
|
|
400
|
-
iconStyle={{ borderWidth: 1 }}
|
|
401
|
-
selectedDate={selectDate}
|
|
402
|
-
datesWhitelist={datesWhitelist}
|
|
403
|
-
disabledDateNameStyle={styles.disabledDateName}
|
|
404
|
-
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
405
|
-
disabledDateOpacity={0.6}
|
|
406
|
-
onDateSelected={(date) => onSelectDate(date)}
|
|
407
|
-
leftSelector={<LeftSelector />}
|
|
408
|
-
rightSelector={<RightSelector />}
|
|
409
|
-
/>
|
|
410
|
-
)}
|
|
411
|
-
</View>
|
|
412
|
-
<TimeListWrapper nestedScrollEnabled={true}>
|
|
413
|
-
{(isEnabled && timeList?.length > 0) ? (
|
|
414
|
-
<TimeContentWrapper>
|
|
415
|
-
{timeList.map((time: any, i: number) => (
|
|
416
|
-
<TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
|
|
417
|
-
<TimeItem active={timeSelected === time.value}>
|
|
418
|
-
<OText
|
|
419
|
-
size={14}
|
|
420
|
-
color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
421
|
-
style={{
|
|
422
|
-
lineHeight: 24
|
|
423
|
-
}}
|
|
424
|
-
>{time.text}</OText>
|
|
425
|
-
</TimeItem>
|
|
426
|
-
</TouchableOpacity>
|
|
427
|
-
))}
|
|
428
|
-
{timeList.length % 3 === 2 && (
|
|
429
|
-
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
430
|
-
)}
|
|
431
|
-
</TimeContentWrapper>
|
|
432
|
-
) : (
|
|
433
|
-
<OText
|
|
434
|
-
size={16}
|
|
435
|
-
style={{
|
|
436
|
-
fontWeight: '600',
|
|
437
|
-
lineHeight: 24,
|
|
438
|
-
marginBottom: 12,
|
|
439
|
-
textAlign: 'center'
|
|
440
|
-
}}
|
|
441
|
-
>
|
|
442
|
-
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
443
|
-
</OText>
|
|
444
|
-
)}
|
|
445
|
-
</TimeListWrapper>
|
|
446
|
-
</OrderTimeWrapper>
|
|
467
|
+
)}
|
|
447
468
|
<OButton
|
|
448
469
|
text={t('GO_TO_MENU', 'Go to menu')}
|
|
449
470
|
textStyle={{ color: 'white' }}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { ProductsList, useLanguage, useUtils, useConfig } from 'ordering-components/native';
|
|
3
3
|
import { SingleProductCard } from '../SingleProductCard';
|
|
4
4
|
import { NotFoundSource } from '../NotFoundSource';
|
|
5
5
|
import { BusinessProductsListParams } from '../../types';
|
|
6
|
-
import { OIcon, OText } from '../shared';
|
|
6
|
+
import { OButton, OIcon, OModal, OText } from '../shared';
|
|
7
7
|
import { ProductsContainer, ErrorMessage, WrapperNotFound } from './styles';
|
|
8
8
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
9
9
|
import { View } from 'react-native';
|
|
10
10
|
import { StyleSheet } from 'react-native';
|
|
11
|
+
import { useTheme } from 'styled-components/native';
|
|
11
12
|
|
|
12
13
|
const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
13
14
|
const {
|
|
@@ -32,8 +33,9 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
32
33
|
const [, t] = useLanguage();
|
|
33
34
|
const [{ optimizeImage }] = useUtils()
|
|
34
35
|
const [{ configs }] = useConfig()
|
|
36
|
+
const theme = useTheme()
|
|
35
37
|
const isUseParentCategory = configs?.use_parent_category?.value === 'true' || configs?.use_parent_category?.value === '1'
|
|
36
|
-
|
|
38
|
+
const [openDescription, setOpenDescription] = useState<any>(null)
|
|
37
39
|
const handleOnLayout = (event: any, categoryId: any) => {
|
|
38
40
|
const _categoriesLayout = { ...categoriesLayout }
|
|
39
41
|
const categoryKey = 'cat_' + categoryId
|
|
@@ -84,8 +86,11 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
84
86
|
|
|
85
87
|
{!category?.id && categories.filter(category => category?.id !== null).map((category, i, _categories) => {
|
|
86
88
|
const products = !isUseParentCategory
|
|
87
|
-
? categoryState?.products?.filter((product
|
|
88
|
-
: categoryState?.products?.filter((product
|
|
89
|
+
? categoryState?.products?.filter((product: any) => product?.category_id === category?.id) ?? []
|
|
90
|
+
: categoryState?.products?.filter((product: any) => category?.children?.some((cat: any) => cat.category_id === product?.category_id)) ?? []
|
|
91
|
+
|
|
92
|
+
const shortCategoryDescription = category?.description?.length > 80 ? `${category?.description?.substring(0, 80)}...` : category?.description
|
|
93
|
+
|
|
89
94
|
return (
|
|
90
95
|
<React.Fragment key={'cat_' + category.id}>
|
|
91
96
|
{products.length > 0 && (
|
|
@@ -96,7 +101,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
96
101
|
>
|
|
97
102
|
<View style={bpStyles.catIcon}>
|
|
98
103
|
<OIcon
|
|
99
|
-
url={optimizeImage(category.image, '
|
|
104
|
+
url={optimizeImage(category.image, 'h_250,c_limit')}
|
|
100
105
|
width={41}
|
|
101
106
|
height={41}
|
|
102
107
|
style={{ borderRadius: 7.6 }}
|
|
@@ -106,6 +111,28 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
106
111
|
{category.name}
|
|
107
112
|
</OText>
|
|
108
113
|
</View>
|
|
114
|
+
{!!category?.description && (
|
|
115
|
+
<View style={{ position: 'relative' }}>
|
|
116
|
+
<OText size={12} weight={'500'} mBottom={5}>
|
|
117
|
+
{shortCategoryDescription}
|
|
118
|
+
{category?.description?.length > 80 && (
|
|
119
|
+
<OButton
|
|
120
|
+
style={{ height: 15, paddingRight: 0, paddingLeft: 0, borderWidth: 0 }}
|
|
121
|
+
text={t('SEE_MORE', 'See more')}
|
|
122
|
+
parentStyle={{ padding: 0 }}
|
|
123
|
+
onClick={() => setOpenDescription(category)}
|
|
124
|
+
bgColor='transparent'
|
|
125
|
+
textStyle={{
|
|
126
|
+
fontSize: 12,
|
|
127
|
+
borderBottomWidth: 1,
|
|
128
|
+
borderBottomColor: theme.colors.primary,
|
|
129
|
+
color: theme.colors.primary
|
|
130
|
+
}}
|
|
131
|
+
/>
|
|
132
|
+
)}
|
|
133
|
+
</OText>
|
|
134
|
+
</View>
|
|
135
|
+
)}
|
|
109
136
|
<>
|
|
110
137
|
{products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
|
|
111
138
|
<SingleProductCard
|
|
@@ -188,6 +215,23 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
188
215
|
<OText>{e}</OText>
|
|
189
216
|
</ErrorMessage>
|
|
190
217
|
))}
|
|
218
|
+
<OModal
|
|
219
|
+
open={!!openDescription}
|
|
220
|
+
title={openDescription?.name}
|
|
221
|
+
onClose={() => setOpenDescription(null)}
|
|
222
|
+
>
|
|
223
|
+
<View style={{ padding: 20 }}>
|
|
224
|
+
{!!openDescription?.image && (
|
|
225
|
+
<OIcon
|
|
226
|
+
url={optimizeImage(openDescription?.image, 'h_100,c_limit')}
|
|
227
|
+
width={240}
|
|
228
|
+
height={240}
|
|
229
|
+
style={{ borderRadius: 7.6 }}
|
|
230
|
+
/>
|
|
231
|
+
)}
|
|
232
|
+
<OText>{openDescription?.description}</OText>
|
|
233
|
+
</View>
|
|
234
|
+
</OModal>
|
|
191
235
|
</ProductsContainer>
|
|
192
236
|
);
|
|
193
237
|
};
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
useSession,
|
|
9
9
|
useUtils,
|
|
10
10
|
ToastType,
|
|
11
|
-
useToast
|
|
11
|
+
useToast,
|
|
12
|
+
useConfig
|
|
12
13
|
} from 'ordering-components/native'
|
|
13
14
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
14
15
|
import { BusinessBasicInformation } from '../BusinessBasicInformation'
|
|
@@ -52,7 +53,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
52
53
|
const [orderState] = useOrder()
|
|
53
54
|
const [{ parsePrice }] = useUtils()
|
|
54
55
|
const [, { showToast }] = useToast()
|
|
55
|
-
|
|
56
|
+
const [{ configs }] = useConfig()
|
|
57
|
+
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
56
58
|
const styles = StyleSheet.create({
|
|
57
59
|
mainContainer: {
|
|
58
60
|
flex: 1,
|
|
@@ -96,10 +98,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
const onProductClick = (product: any) => {
|
|
99
|
-
|
|
101
|
+
onRedirect('ProductDetails', {
|
|
100
102
|
product: product,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
businessSlug: business.slug,
|
|
104
|
+
businessId: business.id,
|
|
103
105
|
})
|
|
104
106
|
}
|
|
105
107
|
|
|
@@ -154,8 +156,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
154
156
|
|
|
155
157
|
const handleTouchDrag = useCallback(() => {
|
|
156
158
|
setCategoryClicked(false);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
+
}, []);
|
|
160
|
+
|
|
159
161
|
const handleBackNavigation = () => {
|
|
160
162
|
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
161
163
|
}
|
|
@@ -218,6 +220,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
218
220
|
openBusinessInformation={openBusinessInformation}
|
|
219
221
|
header={header}
|
|
220
222
|
logo={logo}
|
|
223
|
+
isPreOrder={isPreOrder}
|
|
221
224
|
/>
|
|
222
225
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
223
226
|
{!loading && business?.id && (
|
|
@@ -235,7 +238,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
235
238
|
selectedCategoryId={selectedCategoryId}
|
|
236
239
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
237
240
|
setSelectedCategoryId={setSelectedCategoryId}
|
|
238
|
-
|
|
241
|
+
setCategoryClicked={setCategoryClicked}
|
|
239
242
|
/>
|
|
240
243
|
)}
|
|
241
244
|
</>
|
|
@@ -313,13 +316,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
313
316
|
business={currentCart?.business}
|
|
314
317
|
cartProducts={currentCart?.products}
|
|
315
318
|
cart={currentCart}
|
|
316
|
-
|
|
319
|
+
setOpenUpselling={setOpenUpselling}
|
|
317
320
|
handleUpsellingPage={handleUpsellingPage}
|
|
318
321
|
handleCloseUpsellingPage={handleCloseUpsellingPage}
|
|
319
322
|
openUpselling={openUpselling}
|
|
320
323
|
canOpenUpselling={canOpenUpselling}
|
|
321
324
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
322
|
-
|
|
325
|
+
onRedirect={onRedirect}
|
|
323
326
|
/>
|
|
324
327
|
)}
|
|
325
328
|
</SafeAreaView>
|
|
@@ -237,9 +237,10 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
237
237
|
))}
|
|
238
238
|
</>
|
|
239
239
|
)}
|
|
240
|
-
{
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
{reviewsList?.reviews
|
|
241
|
+
.filter((review: any) => searchReview !== '' ? review.comment?.toLowerCase()?.includes(searchReview?.toLowerCase()) : true).length === 0 && (
|
|
242
|
+
<OText>{t('REVIEWS_NOT_FOUND', 'Reviews Not Found')}</OText>
|
|
243
|
+
)}
|
|
243
244
|
</BusinessReviewContent>
|
|
244
245
|
</BusinessReviewsContainer>
|
|
245
246
|
);
|
|
@@ -61,7 +61,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
61
61
|
handleChangeSearch,
|
|
62
62
|
businessId
|
|
63
63
|
} = props;
|
|
64
|
-
|
|
65
64
|
const theme = useTheme();
|
|
66
65
|
const isFocused = useIsFocused();
|
|
67
66
|
const appState = useRef(AppState.currentState)
|
|
@@ -119,7 +118,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
119
118
|
|
|
120
119
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
121
120
|
Number(configs?.max_days_preorder?.value) > 0
|
|
122
|
-
|
|
121
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
123
122
|
const timerId = useRef<any>(false)
|
|
124
123
|
// const panResponder = useRef(
|
|
125
124
|
// PanResponder.create({
|
|
@@ -167,7 +166,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
167
166
|
|
|
168
167
|
useEffect(() => {
|
|
169
168
|
if (businessesList.businesses.length > 0) {
|
|
170
|
-
const fb = businessesList.businesses.filter((b) => b.featured
|
|
169
|
+
const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
|
|
171
170
|
const ary = [];
|
|
172
171
|
while (fb.length > 0) {
|
|
173
172
|
ary.push(fb.splice(0, 2));
|
|
@@ -287,25 +286,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
287
286
|
style={{ marginStart: 8 }}
|
|
288
287
|
/>
|
|
289
288
|
</WrapMomentOption>
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
289
|
+
{isPreOrderSetting && (
|
|
290
|
+
<WrapMomentOption
|
|
291
|
+
onPress={() => handleMomentClick()}>
|
|
292
|
+
<OText
|
|
293
|
+
size={12}
|
|
294
|
+
numberOfLines={1}
|
|
295
|
+
ellipsizeMode="tail"
|
|
296
|
+
color={theme.colors.textSecondary}>
|
|
297
|
+
{orderState.options?.momentß
|
|
298
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
299
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
300
|
+
</OText>
|
|
301
|
+
{isPreorderEnabled && (
|
|
302
|
+
<OIcon
|
|
303
|
+
src={theme.images.general.arrow_down}
|
|
304
|
+
width={10}
|
|
305
|
+
style={{ marginStart: 8 }}
|
|
306
|
+
/>
|
|
307
|
+
)}
|
|
308
|
+
</WrapMomentOption>
|
|
309
|
+
)}
|
|
309
310
|
|
|
310
311
|
{!businessId && (
|
|
311
312
|
<SearchBar
|
|
@@ -24,6 +24,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
|
24
24
|
import { TaxInformation } from '../TaxInformation';
|
|
25
25
|
import { CartStoresListing } from '../CartStoresListing';
|
|
26
26
|
import { OAlert } from '../../../../../src/components/shared'
|
|
27
|
+
import { PlaceSpot } from '../PlaceSpot'
|
|
27
28
|
|
|
28
29
|
const CartUI = (props: any) => {
|
|
29
30
|
const {
|
|
@@ -54,12 +55,14 @@ const CartUI = (props: any) => {
|
|
|
54
55
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
55
56
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
56
57
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
58
|
+
const [openPlaceModal, setOpenPlaceModal] = useState(false)
|
|
57
59
|
|
|
58
60
|
const isCartPending = cart?.status === 2
|
|
59
61
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
60
62
|
|
|
61
63
|
const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
|
|
62
64
|
const businessId = business?.business_id ?? null
|
|
65
|
+
const placeSpotTypes = [3, 4]
|
|
63
66
|
|
|
64
67
|
const momentFormatted = !orderState?.option?.moment
|
|
65
68
|
? t('RIGHT_NOW', 'Right Now')
|
|
@@ -219,7 +222,7 @@ const CartUI = (props: any) => {
|
|
|
219
222
|
</OSTable>
|
|
220
223
|
))
|
|
221
224
|
}
|
|
222
|
-
<Divider />
|
|
225
|
+
{/* <Divider /> */}
|
|
223
226
|
{cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
|
|
224
227
|
<OSTable>
|
|
225
228
|
<OText size={12} lineHeight={18} numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
@@ -252,7 +255,7 @@ const CartUI = (props: any) => {
|
|
|
252
255
|
<OSRow>
|
|
253
256
|
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
254
257
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
255
|
-
({parsePrice(fee?.fixed)} + {fee
|
|
258
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
|
|
256
259
|
</OText>
|
|
257
260
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
|
|
258
261
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -329,7 +332,7 @@ const CartUI = (props: any) => {
|
|
|
329
332
|
<OText size={12} numberOfLines={1}>
|
|
330
333
|
{walletName[cart?.wallets?.find((wallet: any) => wallet.id === event.wallet_id)?.type]?.name}
|
|
331
334
|
</OText>
|
|
332
|
-
<OText size={12}>-{parsePrice(event.amount)}</OText>
|
|
335
|
+
<OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
|
|
333
336
|
</OSTable>
|
|
334
337
|
))}
|
|
335
338
|
{isCouponEnabled && !isCartPending && (
|
|
@@ -353,6 +356,24 @@ const CartUI = (props: any) => {
|
|
|
353
356
|
</OText>
|
|
354
357
|
</OSTable>
|
|
355
358
|
</OSTotal>
|
|
359
|
+
{placeSpotTypes.includes(orderState?.options?.type) && (
|
|
360
|
+
<OSTable style={{ marginTop: 15 }}>
|
|
361
|
+
<OText size={14} lineHeight={21} weight={'600'}>
|
|
362
|
+
{t('SPOT', 'Spot')}: {cart?.place?.name || t('NO_SELECTED', 'No selected')}
|
|
363
|
+
</OText>
|
|
364
|
+
<TouchableOpacity onPress={() => setOpenPlaceModal(true)}>
|
|
365
|
+
<OText
|
|
366
|
+
size={14}
|
|
367
|
+
lineHeight={21}
|
|
368
|
+
weight={'600'}
|
|
369
|
+
color={theme.colors.primary}
|
|
370
|
+
style={{ textDecorationLine: 'underline' }}
|
|
371
|
+
>
|
|
372
|
+
{t('EDIT', 'Edit')}
|
|
373
|
+
</OText>
|
|
374
|
+
</TouchableOpacity>
|
|
375
|
+
</OSTable>
|
|
376
|
+
)}
|
|
356
377
|
{cart?.status !== 2 && (
|
|
357
378
|
<OSTable>
|
|
358
379
|
<View style={{ width: '100%', marginTop: 20 }}>
|
|
@@ -434,14 +455,26 @@ const CartUI = (props: any) => {
|
|
|
434
455
|
products={cart?.products}
|
|
435
456
|
/>
|
|
436
457
|
</OModal>
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
458
|
+
<OModal
|
|
459
|
+
open={openPlaceModal}
|
|
460
|
+
title={t('CHOOSE_YOUR_SPOT', 'Choose your spot')}
|
|
461
|
+
onClose={() => setOpenPlaceModal(false)}
|
|
462
|
+
entireModal
|
|
463
|
+
>
|
|
464
|
+
<PlaceSpot
|
|
465
|
+
cart={cart}
|
|
466
|
+
isOpenPlaceSpot={openPlaceModal}
|
|
467
|
+
setOpenPlaceModal={setOpenPlaceModal}
|
|
444
468
|
/>
|
|
469
|
+
</OModal>
|
|
470
|
+
<OAlert
|
|
471
|
+
open={confirm.open}
|
|
472
|
+
title={confirm.title}
|
|
473
|
+
content={confirm.content}
|
|
474
|
+
onAccept={confirm.handleOnAccept}
|
|
475
|
+
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
476
|
+
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
477
|
+
/>
|
|
445
478
|
</CContainer>
|
|
446
479
|
)
|
|
447
480
|
}
|