ordering-ui-react-native 0.17.93 → 0.17.94
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 +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/Cart/index.tsx +39 -4
- package/themes/original/src/components/CartContent/index.tsx +29 -28
- package/themes/original/src/components/Checkout/index.tsx +12 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +2 -2
- package/themes/original/src/components/MomentOption/index.tsx +159 -63
- package/themes/original/src/components/MomentOption/styles.tsx +15 -0
- package/themes/original/src/components/OrderSummary/index.tsx +24 -1
- package/themes/original/src/config/constants.tsx +10 -0
- package/themes/original/src/types/index.tsx +9 -1
package/package.json
CHANGED
|
@@ -415,7 +415,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
415
415
|
<BackgroundGray isIos={Platform.OS === 'ios'} />
|
|
416
416
|
)}
|
|
417
417
|
<IOScrollView
|
|
418
|
-
stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 :
|
|
418
|
+
stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 2]}
|
|
419
419
|
style={{
|
|
420
420
|
...styles.mainContainer,
|
|
421
421
|
marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
|
|
@@ -160,7 +160,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
160
160
|
const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
|
|
161
161
|
const [isFarAway, setIsFarAway] = useState(false)
|
|
162
162
|
const [businessTypes, setBusinessTypes] = useState(null)
|
|
163
|
-
const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options
|
|
163
|
+
const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options?.value)
|
|
164
164
|
const [isOpenCities, setIsOpenCities] = useState(false)
|
|
165
165
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
166
166
|
Number(configs?.max_days_preorder?.value) > 0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Cart as CartController,
|
|
4
4
|
useOrder,
|
|
@@ -26,6 +26,7 @@ import { CartStoresListing } from '../CartStoresListing';
|
|
|
26
26
|
import { OAlert } from '../../../../../src/components/shared'
|
|
27
27
|
import { PlaceSpot } from '../PlaceSpot'
|
|
28
28
|
import { DriverTips } from '../DriverTips'
|
|
29
|
+
import { MomentOption } from '../MomentOption'
|
|
29
30
|
|
|
30
31
|
const CartUI = (props: any) => {
|
|
31
32
|
const {
|
|
@@ -43,7 +44,13 @@ const CartUI = (props: any) => {
|
|
|
43
44
|
handleRemoveOfferClick,
|
|
44
45
|
isMultiCheckout,
|
|
45
46
|
hideDeliveryFee,
|
|
46
|
-
hideDriverTip
|
|
47
|
+
hideDriverTip,
|
|
48
|
+
preorderSlotInterval,
|
|
49
|
+
preorderLeadTime,
|
|
50
|
+
preorderTimeRange,
|
|
51
|
+
preorderMaximumDays,
|
|
52
|
+
preorderMinimumDays,
|
|
53
|
+
cateringTypes
|
|
47
54
|
} = props
|
|
48
55
|
|
|
49
56
|
const theme = useTheme();
|
|
@@ -60,7 +67,7 @@ const CartUI = (props: any) => {
|
|
|
60
67
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
61
68
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
62
69
|
const [openPlaceModal, setOpenPlaceModal] = useState(false)
|
|
63
|
-
|
|
70
|
+
const [maxDate, setMaxDate] = useState<any>(null)
|
|
64
71
|
const isCartPending = cart?.status === 2
|
|
65
72
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
66
73
|
const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
|
|
@@ -179,6 +186,19 @@ const CartUI = (props: any) => {
|
|
|
179
186
|
return acc = acc
|
|
180
187
|
}, cart?.subtotal)
|
|
181
188
|
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
const limitDays = parseInt(preorderMaximumDays ?? configs?.max_days_preorder?.value, 10)
|
|
191
|
+
const currentDate = new Date()
|
|
192
|
+
const time = limitDays > 1
|
|
193
|
+
? currentDate.getTime() + ((limitDays - 1) * 24 * 60 * 60 * 1000)
|
|
194
|
+
: limitDays === 1 ? currentDate.getTime() : currentDate.getTime() + (6 * 24 * 60 * 60 * 1000)
|
|
195
|
+
|
|
196
|
+
currentDate.setTime(time)
|
|
197
|
+
currentDate.setHours(23)
|
|
198
|
+
currentDate.setMinutes(59)
|
|
199
|
+
setMaxDate(currentDate)
|
|
200
|
+
}, [preorderMaximumDays, configs?.max_days_preorder?.value])
|
|
201
|
+
|
|
182
202
|
return (
|
|
183
203
|
<CContainer>
|
|
184
204
|
{openUpselling && (
|
|
@@ -486,6 +506,21 @@ const CartUI = (props: any) => {
|
|
|
486
506
|
)}
|
|
487
507
|
</OSBill>
|
|
488
508
|
)}
|
|
509
|
+
{cateringTypes.includes(orderState?.options?.type) && maxDate && cart?.valid_products && (
|
|
510
|
+
<View>
|
|
511
|
+
<MomentOption
|
|
512
|
+
maxDate={maxDate}
|
|
513
|
+
cateringPreorder
|
|
514
|
+
isCart
|
|
515
|
+
preorderSlotInterval={preorderSlotInterval}
|
|
516
|
+
preorderLeadTime={preorderLeadTime}
|
|
517
|
+
preorderTimeRange={preorderTimeRange}
|
|
518
|
+
preorderMaximumDays={preorderMaximumDays}
|
|
519
|
+
preorderMinimumDays={preorderMinimumDays}
|
|
520
|
+
business={cart?.business}
|
|
521
|
+
/>
|
|
522
|
+
</View>
|
|
523
|
+
)}
|
|
489
524
|
{!isMultiCheckout && (
|
|
490
525
|
<>
|
|
491
526
|
{cart?.valid_products ? (
|
|
@@ -502,7 +537,7 @@ const CartUI = (props: any) => {
|
|
|
502
537
|
isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
503
538
|
borderColor={theme.colors.primary}
|
|
504
539
|
imgRightSrc={null}
|
|
505
|
-
textStyle={{ color: '
|
|
540
|
+
textStyle={{ color: '#fff', textAlign: 'center', flex: 1 }}
|
|
506
541
|
onClick={() => setOpenUpselling(true)}
|
|
507
542
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
508
543
|
/>
|
|
@@ -25,37 +25,37 @@ export const CartContent = (props: any) => {
|
|
|
25
25
|
const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
26
26
|
|
|
27
27
|
const handleCheckoutRedirect = () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
if (cartsAvailable.length === 1) {
|
|
29
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
30
|
+
screen: 'CheckoutPage',
|
|
31
|
+
cartUuid: cartsAvailable[0]?.uuid,
|
|
32
|
+
businessLogo: cartsAvailable[0]?.business?.logo,
|
|
33
|
+
businessName: cartsAvailable[0]?.business?.name,
|
|
34
|
+
cartTotal: cartsAvailable[0]?.total
|
|
35
|
+
})
|
|
36
|
+
} else {
|
|
37
|
+
const groupKeys: any = {}
|
|
38
|
+
cartsAvailable.forEach((_cart: any) => {
|
|
39
|
+
groupKeys[_cart?.group?.uuid]
|
|
40
|
+
? groupKeys[_cart?.group?.uuid] += 1
|
|
41
|
+
: groupKeys[_cart?.group?.uuid ?? 'null'] = 1
|
|
42
|
+
})
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
if (
|
|
45
|
+
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
46
|
+
Object.keys(groupKeys).length > 1
|
|
47
|
+
) {
|
|
48
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
49
49
|
screen: 'MultiCheckout',
|
|
50
50
|
checkCarts: true
|
|
51
51
|
})
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
} else {
|
|
53
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
54
|
+
screen: 'MultiCheckout',
|
|
55
|
+
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
return (
|
|
@@ -65,7 +65,7 @@ export const CartContent = (props: any) => {
|
|
|
65
65
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
66
66
|
<>
|
|
67
67
|
{carts.map((cart: any, i: number) => (
|
|
68
|
-
<CCList key={i} style={{ overflow: 'visible' }}>
|
|
68
|
+
<CCList nestedScrollEnabled={true} key={i} style={{ overflow: 'visible' }}>
|
|
69
69
|
{cart.products.length > 0 && (
|
|
70
70
|
<>
|
|
71
71
|
<Cart
|
|
@@ -78,6 +78,7 @@ export const CartContent = (props: any) => {
|
|
|
78
78
|
setIsCartsLoading={setIsCartsLoading}
|
|
79
79
|
isMultiCheckout={isMultiCheckout}
|
|
80
80
|
hideUpselling
|
|
81
|
+
businessConfigs={cart?.business?.configs}
|
|
81
82
|
/>
|
|
82
83
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
83
84
|
</>
|
|
@@ -88,7 +88,8 @@ const CheckoutUI = (props: any) => {
|
|
|
88
88
|
handleChangeDeliveryOption,
|
|
89
89
|
currency,
|
|
90
90
|
merchantId,
|
|
91
|
-
setPlaceSpotNumber
|
|
91
|
+
setPlaceSpotNumber,
|
|
92
|
+
maxDate
|
|
92
93
|
} = props
|
|
93
94
|
|
|
94
95
|
const theme = useTheme();
|
|
@@ -675,6 +676,8 @@ const CheckoutUI = (props: any) => {
|
|
|
675
676
|
isCartPending={cart?.status === 2}
|
|
676
677
|
onNavigationRedirect={onNavigationRedirect}
|
|
677
678
|
placeSpotTypes={placeSpotTypes}
|
|
679
|
+
businessConfigs={businessConfigs}
|
|
680
|
+
maxDate={maxDate}
|
|
678
681
|
/>
|
|
679
682
|
</>
|
|
680
683
|
)}
|
|
@@ -711,6 +714,14 @@ const CheckoutUI = (props: any) => {
|
|
|
711
714
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
712
715
|
</OText>
|
|
713
716
|
)}
|
|
717
|
+
{!cart?.valid_preorder && (
|
|
718
|
+
<OText
|
|
719
|
+
color={theme.colors.error}
|
|
720
|
+
size={12}
|
|
721
|
+
>
|
|
722
|
+
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
723
|
+
</OText>
|
|
724
|
+
)}
|
|
714
725
|
{options.type === 1 &&
|
|
715
726
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
716
727
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -148,8 +148,8 @@ const RedeemGiftCardUI = (props: any) => {
|
|
|
148
148
|
<OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('TYPE', 'Type')}: {redeemedGiftCard?.type}</OText>
|
|
149
149
|
<OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('AMOUNT', 'Amount')}: {parsePrice(redeemedGiftCard?.amount)}</OText>
|
|
150
150
|
<OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('FROM', 'From')}: {redeemedGiftCard?.receiver?.name} {redeemedGiftCard?.receiver?.lastname}</OText>
|
|
151
|
-
<OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('TITLE', 'Title')}: {redeemedGiftCard?.title}</OText>
|
|
152
|
-
<OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('MESSAGES', 'Messages')}: {redeemedGiftCard?.message}</OText>
|
|
151
|
+
{!!redeemedGiftCard?.title && <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('TITLE', 'Title')}: {redeemedGiftCard?.title}</OText>}
|
|
152
|
+
{!!redeemedGiftCard?.message && <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('MESSAGES', 'Messages')}: {redeemedGiftCard?.message}</OText>}
|
|
153
153
|
<OButton
|
|
154
154
|
onClick={() => {
|
|
155
155
|
setRedeemedGiftCard(null)
|
|
@@ -13,8 +13,8 @@ import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
|
13
13
|
import {
|
|
14
14
|
StyleSheet,
|
|
15
15
|
View,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
Platform,
|
|
17
|
+
Pressable
|
|
18
18
|
} from 'react-native';
|
|
19
19
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
20
20
|
import { MomentOptionParams } from '../../types';
|
|
@@ -38,6 +38,14 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
38
38
|
hoursList,
|
|
39
39
|
dateSelected,
|
|
40
40
|
timeSelected,
|
|
41
|
+
cateringPreorder,
|
|
42
|
+
isCart,
|
|
43
|
+
preorderLeadTime,
|
|
44
|
+
business,
|
|
45
|
+
getActualSchedule,
|
|
46
|
+
preorderMaximumDays,
|
|
47
|
+
preorderMinimumDays,
|
|
48
|
+
isPage,
|
|
41
49
|
handleAsap,
|
|
42
50
|
handleChangeDate,
|
|
43
51
|
handleChangeTime,
|
|
@@ -151,8 +159,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
151
159
|
|
|
152
160
|
const [selectedTime, setSelectedTime] = useState(null);
|
|
153
161
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
154
|
-
const [selectDate, setSelectedDate] = useState<any>(
|
|
155
|
-
|
|
162
|
+
const [selectDate, setSelectedDate] = useState<any>(dateSelected)
|
|
163
|
+
const [timeList, setTimeList] = useState<any>(hoursList)
|
|
156
164
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack();
|
|
157
165
|
|
|
158
166
|
const _handleAsap = () => {
|
|
@@ -164,9 +172,9 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
164
172
|
}
|
|
165
173
|
};
|
|
166
174
|
|
|
167
|
-
const handleChangeMoment = () => {
|
|
175
|
+
const handleChangeMoment = (time?: any) => {
|
|
168
176
|
setMomentState({ isLoading: 1, isEditing: true });
|
|
169
|
-
handleChangeTime(selectedTime);
|
|
177
|
+
handleChangeTime(time ?? selectedTime);
|
|
170
178
|
};
|
|
171
179
|
|
|
172
180
|
const momento = moment(
|
|
@@ -205,6 +213,14 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
205
213
|
if (handleChangeDate) handleChangeDate(moment(val).format('YYYY-MM-DD'))
|
|
206
214
|
}
|
|
207
215
|
|
|
216
|
+
const handleChangeTimeSelected = (time: any) => {
|
|
217
|
+
if (cateringPreorder) {
|
|
218
|
+
handleChangeMoment(time)
|
|
219
|
+
} else {
|
|
220
|
+
setSelectedTime(time)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
208
224
|
const LeftSelector = () => {
|
|
209
225
|
return (
|
|
210
226
|
<View style={{ height: '100%', justifyContent: 'flex-end' }}>
|
|
@@ -231,20 +247,25 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
231
247
|
|
|
232
248
|
useEffect(() => {
|
|
233
249
|
if (datesList?.length > 0) {
|
|
234
|
-
const _datesList = datesList.slice(0, Number(configs?.max_days_preorder?.value
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
250
|
+
const _datesList = datesList.slice((cateringPreorder && preorderMinimumDays) || 0, Number(cateringPreorder ? preorderMaximumDays || configs?.max_days_preorder?.value : configs?.max_days_preorder?.value ?? 6))
|
|
251
|
+
if (_datesList?.length > 0) {
|
|
252
|
+
const minDateParts = _datesList?.[0]?.split('-')
|
|
253
|
+
const maxDateParts = _datesList[_datesList.length - 1].split('-')
|
|
254
|
+
const _minDate = new Date(minDateParts[0], minDateParts[1] - 1, minDateParts[2])
|
|
255
|
+
const _maxDate = new Date(maxDateParts[0], maxDateParts[1] - 1, maxDateParts[2])
|
|
256
|
+
setDateWhitelist([{ start: _minDate, end: _maxDate }])
|
|
257
|
+
}
|
|
240
258
|
}
|
|
241
|
-
}, [datesList])
|
|
259
|
+
}, [JSON.stringify(datesList), preorderMinimumDays, preorderMaximumDays])
|
|
242
260
|
|
|
243
261
|
useEffect(() => {
|
|
244
262
|
if (dateSelected) {
|
|
245
263
|
const dateParts = dateSelected.split('-')
|
|
246
264
|
const _dateSelected = new Date(dateParts[0], dateParts[1] - 1, dateParts[2])
|
|
247
265
|
setSelectedDate(_dateSelected)
|
|
266
|
+
if (cateringPreorder) {
|
|
267
|
+
onSelectDate(_dateSelected)
|
|
268
|
+
}
|
|
248
269
|
}
|
|
249
270
|
}, [dateSelected])
|
|
250
271
|
|
|
@@ -252,42 +273,98 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
252
273
|
setSelectedTime(timeSelected)
|
|
253
274
|
}, [timeSelected])
|
|
254
275
|
|
|
276
|
+
useEffect(() => {
|
|
277
|
+
if (cateringPreorder) {
|
|
278
|
+
let _timeLists = []
|
|
279
|
+
const schedule = business && getActualSchedule()
|
|
280
|
+
if (!schedule && business) {
|
|
281
|
+
return
|
|
282
|
+
}
|
|
283
|
+
_timeLists = hoursList
|
|
284
|
+
.filter(hour => (!business || schedule?.lapses?.some((lapse: any) =>
|
|
285
|
+
moment(dateSelected + ` ${hour.startTime}`) >= moment(dateSelected + ` ${lapse.open.hour}:${lapse.open.minute}`).add(preorderLeadTime, 'minutes') && moment(dateSelected + ` ${hour.endTime}`) <= moment(dateSelected + ` ${lapse.close.hour}:${lapse.close.minute}`))) &&
|
|
286
|
+
moment(dateSelected + ` ${hour.startTime}`) < moment(dateSelected + ` ${hour.endTime}`) &&
|
|
287
|
+
(moment().add(preorderLeadTime, 'minutes') < moment(dateSelected + ` ${hour.startTime}`) || !cateringPreorder))
|
|
288
|
+
.map(hour => {
|
|
289
|
+
return {
|
|
290
|
+
value: hour.startTime,
|
|
291
|
+
text: is12hours ? (
|
|
292
|
+
hour.startTime.includes('12')
|
|
293
|
+
? `${hour.startTime}PM`
|
|
294
|
+
: parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|
|
295
|
+
) : (
|
|
296
|
+
parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'HH:mm' })
|
|
297
|
+
),
|
|
298
|
+
endText: is12hours ? (
|
|
299
|
+
hour.endTime.includes('12')
|
|
300
|
+
? `${hour.endTime}PM`
|
|
301
|
+
: parseTime(moment(hour.endTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|
|
302
|
+
) : (
|
|
303
|
+
parseTime(moment(hour.endTime, 'HH:mm'), { outputFormat: 'HH:mm' })
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
if (_timeLists?.length > 0) {
|
|
308
|
+
setTimeList(_timeLists)
|
|
309
|
+
}
|
|
310
|
+
} else {
|
|
311
|
+
setTimeList(hoursList.map(hour => {
|
|
312
|
+
return {
|
|
313
|
+
value: hour.startTime,
|
|
314
|
+
text: is12hours ? (
|
|
315
|
+
hour.startTime.includes('12')
|
|
316
|
+
? `${hour.startTime}PM`
|
|
317
|
+
: parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|
|
318
|
+
) : (
|
|
319
|
+
parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'HH:mm' })
|
|
320
|
+
)
|
|
321
|
+
}
|
|
322
|
+
}))
|
|
323
|
+
}
|
|
324
|
+
}, [dateSelected, JSON.stringify(hoursList), JSON.stringify(datesWhitelist), cateringPreorder])
|
|
325
|
+
|
|
255
326
|
return (
|
|
256
327
|
<>
|
|
257
328
|
<Container
|
|
258
329
|
style={{
|
|
259
|
-
paddingLeft: 40,
|
|
260
|
-
paddingRight: 40
|
|
261
|
-
}}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
330
|
+
paddingLeft: !cateringPreorder || isPage ? 40 : 0,
|
|
331
|
+
paddingRight: !cateringPreorder || isPage ? 40 : 0
|
|
332
|
+
}}
|
|
333
|
+
nestedScrollEnabled
|
|
334
|
+
>
|
|
335
|
+
<View style={{ paddingBottom: cateringPreorder ? 0 : 90, paddingRight: 20 }}>
|
|
336
|
+
{!isCart && (
|
|
337
|
+
<NavBar
|
|
338
|
+
onActionLeft={() => goToBack()}
|
|
339
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
340
|
+
style={{ paddingBottom: 0 }}
|
|
341
|
+
paddingTop={Platform.OS === 'ios' ? 10 : 0}
|
|
342
|
+
title={t('QUESTION_WHEN_ORDER', 'When do you want your order?')}
|
|
343
|
+
titleAlign={'center'}
|
|
344
|
+
titleStyle={{ fontSize: 20, marginRight: 0, marginLeft: 0 }}
|
|
345
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
346
|
+
/>
|
|
347
|
+
)}
|
|
348
|
+
{(preorderMinimumDays === 0 && preorderLeadTime === 0) || !cateringPreorder && (
|
|
349
|
+
<WrapSelectOption
|
|
350
|
+
onPress={() => _handleAsap()}
|
|
351
|
+
disabled={orderState.loading} style={{ alignItems: 'flex-start' }}>
|
|
352
|
+
{optionSelected.isAsap ? (
|
|
353
|
+
<OIcon
|
|
354
|
+
src={theme.images.general.option_checked}
|
|
355
|
+
width={16}
|
|
356
|
+
style={{ marginEnd: 24 }}
|
|
357
|
+
/>
|
|
358
|
+
) : (
|
|
359
|
+
<OIcon
|
|
360
|
+
src={theme.images.general.option_normal}
|
|
361
|
+
width={16}
|
|
362
|
+
style={{ marginEnd: 24 }}
|
|
363
|
+
/>
|
|
364
|
+
)}
|
|
365
|
+
<OText color={optionSelected.isAsap ? theme.colors.textNormal : theme.colors.disabled}>{t('ASAP_ABBREVIATION', 'ASAP') + ` (${t(moment().format('dddd')?.toLocaleUpperCase(), moment().format('dddd'))}, ${t(monthsEnum[moment().format('MMM')], moment().format('MMM'))}${moment().format(' D, yyyy h:mm A')} + ${t('DELIVERY_TIME', 'delivery time')})`}</OText>
|
|
366
|
+
</WrapSelectOption>
|
|
367
|
+
)}
|
|
291
368
|
<WrapSelectOption
|
|
292
369
|
onPress={() => setOptionSelected({ isAsap: false, isSchedule: true })}
|
|
293
370
|
disabled={orderState.loading}>
|
|
@@ -326,8 +403,10 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
326
403
|
highlightDateContainerStyle={{ height: '100%' }}
|
|
327
404
|
calendarHeaderFormat='MMMM, YYYY'
|
|
328
405
|
iconStyle={{ borderWidth: 1 }}
|
|
329
|
-
selectedDate={
|
|
406
|
+
selectedDate={dateSelected}
|
|
330
407
|
datesWhitelist={datesWhitelist}
|
|
408
|
+
minDate={moment()}
|
|
409
|
+
maxDate={cateringPreorder ? moment().add(preorderMaximumDays, 'days') : undefined}
|
|
331
410
|
disabledDateNameStyle={styles.disabledDateName}
|
|
332
411
|
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
333
412
|
disabledDateOpacity={0.6}
|
|
@@ -337,27 +416,42 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
337
416
|
/>
|
|
338
417
|
)}
|
|
339
418
|
</View>
|
|
340
|
-
<TimeListWrapper nestedScrollEnabled={true}>
|
|
419
|
+
<TimeListWrapper nestedScrollEnabled={true} cateringPreorder={cateringPreorder}>
|
|
341
420
|
<TimeContentWrapper>
|
|
342
|
-
{
|
|
343
|
-
<
|
|
344
|
-
<TimeItem
|
|
421
|
+
{timeList.map((time: any, i: number) => (
|
|
422
|
+
<Pressable key={i} onPress={() => handleChangeTimeSelected(time.value)}>
|
|
423
|
+
<TimeItem
|
|
424
|
+
active={selectedTime === time.value}
|
|
425
|
+
cateringPreorder={cateringPreorder}
|
|
426
|
+
>
|
|
427
|
+
{cateringPreorder && (
|
|
428
|
+
<>
|
|
429
|
+
{selectedTime === time.value ? (
|
|
430
|
+
<OIcon
|
|
431
|
+
src={theme.images.general.option_checked}
|
|
432
|
+
width={18}
|
|
433
|
+
style={{ marginEnd: 24, bottom: 2 }}
|
|
434
|
+
/>
|
|
435
|
+
) : (
|
|
436
|
+
<OIcon
|
|
437
|
+
src={theme.images.general.option_normal}
|
|
438
|
+
width={18}
|
|
439
|
+
style={{ marginEnd: 24, bottom: 2 }}
|
|
440
|
+
/>
|
|
441
|
+
)}
|
|
442
|
+
</>
|
|
443
|
+
)}
|
|
345
444
|
<OText
|
|
346
|
-
size={
|
|
347
|
-
color={selectedTime === time.
|
|
445
|
+
size={cateringPreorder ? 18 : 16}
|
|
446
|
+
color={selectedTime === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
348
447
|
style={{
|
|
349
448
|
lineHeight: 24
|
|
350
449
|
}}
|
|
351
|
-
>{
|
|
352
|
-
time.startTime.includes('12')
|
|
353
|
-
? `${time.startTime}PM`
|
|
354
|
-
: parseTime(moment(time.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|
|
355
|
-
) : time.startTime
|
|
356
|
-
}</OText>
|
|
450
|
+
>{time.text} {cateringPreorder && `- ${time.endText}`}</OText>
|
|
357
451
|
</TimeItem>
|
|
358
|
-
</
|
|
452
|
+
</Pressable>
|
|
359
453
|
))}
|
|
360
|
-
{
|
|
454
|
+
{timeList.length % 3 === 2 && (
|
|
361
455
|
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
362
456
|
)}
|
|
363
457
|
</TimeContentWrapper>
|
|
@@ -367,9 +461,11 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
367
461
|
</View>
|
|
368
462
|
<Spinner visible={momentState.isLoading === 1} />
|
|
369
463
|
</Container>
|
|
370
|
-
|
|
371
|
-
<
|
|
372
|
-
|
|
464
|
+
{!isCart && (
|
|
465
|
+
<View style={{ position: 'absolute', bottom: bottom, paddingBottom: 20, paddingHorizontal: 40, backgroundColor: 'white', width: '100%' }}>
|
|
466
|
+
<OButton onClick={handleChangeMoment} isDisabled={!selectedTime} text={t('CONTINUE', 'Continue')} style={{ borderRadius: 7.6, height: 44, shadowOpacity: 0 }} textStyle={{ color: 'white', fontSize: 14 }} showNextIcon />
|
|
467
|
+
</View>
|
|
468
|
+
)}
|
|
373
469
|
</>
|
|
374
470
|
);
|
|
375
471
|
};
|
|
@@ -19,6 +19,10 @@ export const OrderTimeWrapper = styled.View`
|
|
|
19
19
|
export const TimeListWrapper = styled.ScrollView`
|
|
20
20
|
margin-top: 30px;
|
|
21
21
|
max-height: 210px;
|
|
22
|
+
${({ cateringPreorder }: any) => cateringPreorder && css`
|
|
23
|
+
max-height: 250px;
|
|
24
|
+
height: 250px;
|
|
25
|
+
`}
|
|
22
26
|
`
|
|
23
27
|
|
|
24
28
|
export const TimeContentWrapper = styled.View`
|
|
@@ -26,6 +30,7 @@ export const TimeContentWrapper = styled.View`
|
|
|
26
30
|
flex-wrap: wrap;
|
|
27
31
|
flex-direction: row;
|
|
28
32
|
justify-content: space-between;
|
|
33
|
+
|
|
29
34
|
`
|
|
30
35
|
|
|
31
36
|
export const TimeItem = styled.View`
|
|
@@ -36,6 +41,16 @@ export const TimeItem = styled.View`
|
|
|
36
41
|
justify-content: center;
|
|
37
42
|
align-items: center;
|
|
38
43
|
margin: 10px 0px;
|
|
44
|
+
${({ cateringPreorder }: any) => cateringPreorder && css`
|
|
45
|
+
background: #fff;
|
|
46
|
+
width: 100%;
|
|
47
|
+
min-width: 100%;
|
|
48
|
+
height: 50px;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
justify-content: flex-start;
|
|
51
|
+
padding-left: 10px;
|
|
52
|
+
margin: 0;
|
|
53
|
+
`}
|
|
39
54
|
${({ active }: any) => active && css`
|
|
40
55
|
background: #F5F9FF;
|
|
41
56
|
`}
|
|
@@ -26,6 +26,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
|
26
26
|
import { TaxInformation } from '../TaxInformation';
|
|
27
27
|
import { TouchableOpacity } from 'react-native';
|
|
28
28
|
import { OAlert } from '../../../../../src/components/shared'
|
|
29
|
+
import { MomentOption } from '../MomentOption';
|
|
29
30
|
|
|
30
31
|
const OrderSummaryUI = (props: any) => {
|
|
31
32
|
const {
|
|
@@ -38,7 +39,14 @@ const OrderSummaryUI = (props: any) => {
|
|
|
38
39
|
commentState,
|
|
39
40
|
handleChangeComment,
|
|
40
41
|
onNavigationRedirect,
|
|
41
|
-
handleRemoveOfferClick
|
|
42
|
+
handleRemoveOfferClick,
|
|
43
|
+
preorderSlotInterval,
|
|
44
|
+
preorderLeadTime,
|
|
45
|
+
preorderTimeRange,
|
|
46
|
+
preorderMaximumDays,
|
|
47
|
+
preorderMinimumDays,
|
|
48
|
+
cateringTypes,
|
|
49
|
+
maxDate
|
|
42
50
|
} = props;
|
|
43
51
|
|
|
44
52
|
const theme = useTheme()
|
|
@@ -339,6 +347,21 @@ const OrderSummaryUI = (props: any) => {
|
|
|
339
347
|
)}
|
|
340
348
|
</OSBill>
|
|
341
349
|
)}
|
|
350
|
+
{cateringTypes.includes(orderState?.options?.type) && maxDate && cart?.business && (
|
|
351
|
+
<View>
|
|
352
|
+
<MomentOption
|
|
353
|
+
maxDate={maxDate}
|
|
354
|
+
cateringPreorder
|
|
355
|
+
isCart
|
|
356
|
+
preorderSlotInterval={preorderSlotInterval}
|
|
357
|
+
preorderLeadTime={preorderLeadTime}
|
|
358
|
+
preorderTimeRange={preorderTimeRange}
|
|
359
|
+
preorderMaximumDays={preorderMaximumDays}
|
|
360
|
+
preorderMinimumDays={preorderMinimumDays}
|
|
361
|
+
business={cart?.business}
|
|
362
|
+
/>
|
|
363
|
+
</View>
|
|
364
|
+
)}
|
|
342
365
|
<OModal
|
|
343
366
|
open={openTaxModal.open}
|
|
344
367
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
@@ -29,5 +29,15 @@ export const ORDER_TYPES = [
|
|
|
29
29
|
value: 5,
|
|
30
30
|
content: 'DRIVE_THRU',
|
|
31
31
|
description: 'ORDERTYPE_DESCRIPTION_DRIVETHRU',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: 7,
|
|
35
|
+
content: 'CATERING_DELIVERY',
|
|
36
|
+
description: 'ORDERTYPE_DESCRIPTION_CATERING_DELIVERY',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: 8,
|
|
40
|
+
content: 'CATERING_PICKUP',
|
|
41
|
+
description: 'ORDERTYPE_DESCRIPTION_CATERING_PICKUP',
|
|
32
42
|
}
|
|
33
43
|
]
|
|
@@ -318,7 +318,7 @@ export interface SingleProductCardParams {
|
|
|
318
318
|
navigation?: any;
|
|
319
319
|
isPreviously?: any;
|
|
320
320
|
isProductId?: any;
|
|
321
|
-
viewString?: string;
|
|
321
|
+
viewString?: string;
|
|
322
322
|
}
|
|
323
323
|
export interface BusinessInformationParams {
|
|
324
324
|
navigation?: any,
|
|
@@ -544,6 +544,14 @@ export interface MomentOptionParams {
|
|
|
544
544
|
dateSelected?: any;
|
|
545
545
|
timeSelected?: any;
|
|
546
546
|
isAsap?: boolean;
|
|
547
|
+
cateringPreorder?: boolean,
|
|
548
|
+
isCart?: boolean,
|
|
549
|
+
preorderLeadTime?: number,
|
|
550
|
+
business?: any,
|
|
551
|
+
getActualSchedule?: any,
|
|
552
|
+
preorderMaximumDays?: number,
|
|
553
|
+
preorderMinimumDays?: number,
|
|
554
|
+
isPage?: boolean,
|
|
547
555
|
handleAsap: () => {};
|
|
548
556
|
handleChangeDate: (value: any) => {};
|
|
549
557
|
handleChangeTime: (value: any) => {};
|