ordering-ui-react-native 0.15.42 → 0.15.45
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/business/src/components/OrdersListManager/index.tsx +51 -48
- package/themes/business/src/components/OrdersOption/index.tsx +52 -48
- package/themes/business/src/components/PreviousOrders/index.tsx +48 -13
- package/themes/original/index.tsx +14 -2
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +71 -42
- package/themes/original/src/components/BusinessController/index.tsx +2 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +6 -4
- package/themes/original/src/components/BusinessProductsList/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +7 -5
- package/themes/original/src/components/Cart/index.tsx +0 -2
- package/themes/original/src/components/OrderDetails/index.tsx +0 -2
- package/themes/original/src/components/OrderProgress/index.tsx +2 -2
- package/themes/original/src/components/OrderSummary/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +3 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +14 -12
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
package/package.json
CHANGED
|
@@ -77,6 +77,7 @@ const OrdersListManagerUI = (props: OrdersOptionParams) => {
|
|
|
77
77
|
const [openSearchModal, setOpenSearchModal] = useState(false)
|
|
78
78
|
const [openSLASettingModal, setOpenSLASettingModal] = useState(false)
|
|
79
79
|
const [slaSettingTime, setSlaSettingTime] = useState(6000)
|
|
80
|
+
const [configState] = useConfig()
|
|
80
81
|
const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
|
|
81
82
|
const [search, setSearch] = useState(defaultSearchList)
|
|
82
83
|
const [selectedTabStatus, setSelectedTabStatus] = useState<any>([])
|
|
@@ -311,55 +312,57 @@ const OrdersListManagerUI = (props: OrdersOptionParams) => {
|
|
|
311
312
|
/>
|
|
312
313
|
</IconWrapper>
|
|
313
314
|
</View>
|
|
314
|
-
|
|
315
|
-
<View style={
|
|
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
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
315
|
+
{configState?.configs?.order_deadlines_enabled?.value === '1' && (
|
|
316
|
+
<View style={styles.SLAwrapper}>
|
|
317
|
+
<View style={{ flex: 0.5 }}>
|
|
318
|
+
<OButton
|
|
319
|
+
text={t('SLA_SETTING', 'SLA’s Settings')}
|
|
320
|
+
textStyle={{ color: theme.colors.backArrow }}
|
|
321
|
+
imgRightSrc={null}
|
|
322
|
+
style={{
|
|
323
|
+
backgroundColor: theme.colors.inputChat,
|
|
324
|
+
borderRadius: 7.6,
|
|
325
|
+
zIndex: 10,
|
|
326
|
+
borderWidth: 0,
|
|
327
|
+
minHeight: 40
|
|
328
|
+
}}
|
|
329
|
+
onClick={onClickSetting}
|
|
330
|
+
/>
|
|
331
|
+
</View>
|
|
332
|
+
<View style={{ width: 10, height: '100%' }} />
|
|
333
|
+
<View style={{ flex: 0.5, justifyContent: 'center' }}>
|
|
334
|
+
<SelectDropdown
|
|
335
|
+
defaultButtonText={t('SLA', 'SLA\'s')}
|
|
336
|
+
data={preorderTypeList}
|
|
337
|
+
onSelect={(selectedItem, index) => {
|
|
338
|
+
onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
|
|
339
|
+
}}
|
|
340
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
341
|
+
return selectedItem.name
|
|
342
|
+
}}
|
|
343
|
+
rowTextForSelection={(item, index) => {
|
|
344
|
+
return item.key
|
|
345
|
+
}}
|
|
346
|
+
buttonStyle={styles.selectOption}
|
|
347
|
+
buttonTextStyle={styles.buttonTextStyle}
|
|
348
|
+
renderDropdownIcon={isOpened => {
|
|
349
|
+
return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
|
|
350
|
+
}}
|
|
351
|
+
dropdownStyle={styles.dropdownStyle}
|
|
352
|
+
dropdownOverlayColor='transparent'
|
|
353
|
+
rowStyle={styles.rowStyle}
|
|
354
|
+
renderCustomizedRowChild={(item, index) => {
|
|
355
|
+
return (
|
|
356
|
+
<SlaOption>
|
|
357
|
+
{index !== 0 && <OrderStatus timeState={item?.key} />}
|
|
358
|
+
<View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
|
|
359
|
+
</SlaOption>
|
|
360
|
+
);
|
|
361
|
+
}}
|
|
362
|
+
/>
|
|
363
|
+
</View>
|
|
361
364
|
</View>
|
|
362
|
-
|
|
365
|
+
)}
|
|
363
366
|
|
|
364
367
|
<Sides>
|
|
365
368
|
<LeftSide>
|
|
@@ -110,6 +110,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
110
110
|
const theme = useTheme();
|
|
111
111
|
const [, t] = useLanguage();
|
|
112
112
|
const [{ parseDate }] = useUtils()
|
|
113
|
+
const [configState] = useConfig()
|
|
113
114
|
const [orientationState] = useDeviceOrientation();
|
|
114
115
|
const [, { showToast }] = useToast();
|
|
115
116
|
const [openSearchModal, setOpenSearchModal] = useState(false)
|
|
@@ -439,55 +440,57 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
439
440
|
/>
|
|
440
441
|
</IconWrapper>
|
|
441
442
|
</View>
|
|
442
|
-
|
|
443
|
-
<View style={
|
|
444
|
-
<
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
<
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
443
|
+
{configState?.configs?.order_deadlines_enabled?.value === '1' && (
|
|
444
|
+
<View style={styles.SLAwrapper}>
|
|
445
|
+
<View style={{ flex: 0.5 }}>
|
|
446
|
+
<OButton
|
|
447
|
+
text={t('SLA_SETTING', 'SLA’s Settings')}
|
|
448
|
+
textStyle={{ color: theme.colors.backArrow }}
|
|
449
|
+
imgRightSrc={null}
|
|
450
|
+
style={{
|
|
451
|
+
backgroundColor: theme.colors.inputChat,
|
|
452
|
+
borderRadius: 7.6,
|
|
453
|
+
zIndex: 10,
|
|
454
|
+
borderWidth: 0,
|
|
455
|
+
minHeight: 40
|
|
456
|
+
}}
|
|
457
|
+
onClick={onClickSetting}
|
|
458
|
+
/>
|
|
459
|
+
</View>
|
|
460
|
+
<View style={{ width: 10, height: '100%' }} />
|
|
461
|
+
<View style={{ flex: 0.5, justifyContent: 'center' }}>
|
|
462
|
+
<SelectDropdown
|
|
463
|
+
defaultButtonText={t('SLA', 'SLA\'s')}
|
|
464
|
+
data={preorderTypeList}
|
|
465
|
+
onSelect={(selectedItem, index) => {
|
|
466
|
+
onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
|
|
467
|
+
}}
|
|
468
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
469
|
+
return selectedItem.name
|
|
470
|
+
}}
|
|
471
|
+
rowTextForSelection={(item, index) => {
|
|
472
|
+
return item.key
|
|
473
|
+
}}
|
|
474
|
+
buttonStyle={styles.selectOption}
|
|
475
|
+
buttonTextStyle={styles.buttonTextStyle}
|
|
476
|
+
renderDropdownIcon={isOpened => {
|
|
477
|
+
return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
|
|
478
|
+
}}
|
|
479
|
+
dropdownStyle={styles.dropdownStyle}
|
|
480
|
+
dropdownOverlayColor='transparent'
|
|
481
|
+
rowStyle={styles.rowStyle}
|
|
482
|
+
renderCustomizedRowChild={(item, index) => {
|
|
483
|
+
return (
|
|
484
|
+
<SlaOption>
|
|
485
|
+
{index !== 0 && <OrderStatus timeState={item?.key} />}
|
|
486
|
+
<View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
|
|
487
|
+
</SlaOption>
|
|
488
|
+
);
|
|
489
|
+
}}
|
|
490
|
+
/>
|
|
491
|
+
</View>
|
|
489
492
|
</View>
|
|
490
|
-
|
|
493
|
+
)}
|
|
491
494
|
<FiltersTab>
|
|
492
495
|
<ScrollView
|
|
493
496
|
ref={scrollRefTab}
|
|
@@ -926,6 +929,7 @@ export const Timer = () => {
|
|
|
926
929
|
|
|
927
930
|
export const OrdersOption = (props: OrdersOptionParams) => {
|
|
928
931
|
const [, t] = useLanguage();
|
|
932
|
+
const [configState] = useConfig()
|
|
929
933
|
const theme = useTheme()
|
|
930
934
|
const ordersProps = {
|
|
931
935
|
...props,
|
|
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
2
2
|
import { StyleSheet, TouchableOpacity, View, Platform, PlatformIOSStatic } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import moment from 'moment'
|
|
5
|
-
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
|
+
import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
|
|
6
6
|
import { OButton, OIcon, OText } from '../shared';
|
|
7
7
|
import {
|
|
8
8
|
Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder, Timestatus
|
|
@@ -27,8 +27,14 @@ export const PreviousOrders = (props: any) => {
|
|
|
27
27
|
} = props;
|
|
28
28
|
const [, t] = useLanguage();
|
|
29
29
|
const [{ parseDate, optimizeImage }] = useUtils();
|
|
30
|
+
const [configState] = useConfig()
|
|
30
31
|
const theme = useTheme();
|
|
31
|
-
const [
|
|
32
|
+
const [, setCurrentTime] = useState()
|
|
33
|
+
const [allowColumns, setAllowColumns] = useState({
|
|
34
|
+
timer: true,
|
|
35
|
+
slaBar: true,
|
|
36
|
+
})
|
|
37
|
+
|
|
32
38
|
const [orientationState] = useDeviceOrientation();
|
|
33
39
|
|
|
34
40
|
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
@@ -93,23 +99,41 @@ export const PreviousOrders = (props: any) => {
|
|
|
93
99
|
},
|
|
94
100
|
});
|
|
95
101
|
|
|
96
|
-
|
|
102
|
+
|
|
103
|
+
const getDelayMinutes = (order: any) => {
|
|
97
104
|
// targetMin = delivery_datetime + eta_time - now()
|
|
105
|
+
const offset = 300
|
|
106
|
+
const cdtToutc = parseDate(moment(order?.delivery_datetime).add(offset, 'minutes'))
|
|
98
107
|
const _delivery = order?.delivery_datetime_utc
|
|
108
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
109
|
+
: parseDate(cdtToutc)
|
|
99
110
|
const _eta = order?.eta_time
|
|
100
|
-
|
|
111
|
+
return moment(_delivery.replace('AM', '')).add(_eta, 'minutes').diff(moment().utc(), 'minutes')
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const displayDelayedTime = (order: any) => {
|
|
115
|
+
let tagetedMin = getDelayMinutes(order)
|
|
116
|
+
// get day, hour and minutes
|
|
117
|
+
const sign = tagetedMin >= 0 ? '' : '- '
|
|
118
|
+
tagetedMin = Math.abs(tagetedMin)
|
|
101
119
|
let day = Math.floor(tagetedMin / 1440)
|
|
102
120
|
const restMinOfTargetedMin = tagetedMin - 1440 * day
|
|
103
|
-
let restHours
|
|
104
|
-
let restMins
|
|
121
|
+
let restHours = Math.floor(restMinOfTargetedMin / 60)
|
|
122
|
+
let restMins = restMinOfTargetedMin - 60 * restHours
|
|
123
|
+
// make standard time format
|
|
124
|
+
day = day === 0 ? '' : day + 'day '
|
|
125
|
+
restHours = restHours < 10 ? '0' + restHours : restHours
|
|
126
|
+
restMins = restMins < 10 ? '0' + restMins : restMins
|
|
105
127
|
|
|
106
|
-
|
|
107
|
-
if (restHours < 10) restHours = ('0' + restHours)
|
|
108
|
-
if (restMins < 10) restMins = ('0' + restMins)
|
|
109
|
-
const finalTaget = day + 'day ' + restHours + ':' + restMins
|
|
128
|
+
const finalTaget = sign + day + restHours + ':' + restMins
|
|
110
129
|
return finalTaget
|
|
111
130
|
}
|
|
112
131
|
|
|
132
|
+
const getStatusClassName = (minutes: any) => {
|
|
133
|
+
if (isNaN(Number(minutes))) return 0
|
|
134
|
+
return minutes > 0 ? 'in_time' : minutes === 0 ? 'at_risk' : 'delayed'
|
|
135
|
+
}
|
|
136
|
+
|
|
113
137
|
useEffect(() => {
|
|
114
138
|
const interval = setInterval(() => {
|
|
115
139
|
const date: any = Date.now()
|
|
@@ -119,6 +143,15 @@ export const PreviousOrders = (props: any) => {
|
|
|
119
143
|
return () => clearInterval(interval)
|
|
120
144
|
}, [])
|
|
121
145
|
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
|
|
148
|
+
setAllowColumns({
|
|
149
|
+
...allowColumns,
|
|
150
|
+
timer: slaSettings,
|
|
151
|
+
slaBar: slaSettings
|
|
152
|
+
})
|
|
153
|
+
}, [configState.loading])
|
|
154
|
+
|
|
122
155
|
let hash: any = {};
|
|
123
156
|
|
|
124
157
|
return (
|
|
@@ -144,7 +177,9 @@ export const PreviousOrders = (props: any) => {
|
|
|
144
177
|
activeOpacity={1}
|
|
145
178
|
>
|
|
146
179
|
<Card key={order.id}>
|
|
147
|
-
|
|
180
|
+
{allowColumns?.slaBar && (
|
|
181
|
+
<Timestatus style={{ backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : '' }} />
|
|
182
|
+
)}
|
|
148
183
|
{
|
|
149
184
|
order.business?.logo && (
|
|
150
185
|
<Logo style={styles.logo}>
|
|
@@ -189,10 +224,10 @@ export const PreviousOrders = (props: any) => {
|
|
|
189
224
|
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
|
|
190
225
|
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
191
226
|
</OText>
|
|
192
|
-
{(currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && (
|
|
227
|
+
{((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
|
|
193
228
|
<>
|
|
194
229
|
<OText> · </OText>
|
|
195
|
-
<OText style={styles.date} color={order
|
|
230
|
+
<OText style={styles.date} color={getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : ''} >{displayDelayedTime(order)}</OText>
|
|
196
231
|
</>
|
|
197
232
|
)}
|
|
198
233
|
</View>
|
|
@@ -44,6 +44,12 @@ import { ProductForm } from './src/components/ProductForm';
|
|
|
44
44
|
import { UpsellingProducts } from './src/components/UpsellingProducts';
|
|
45
45
|
import { UserVerification } from './src/components/UserVerification';
|
|
46
46
|
import { BusinessListingSearch } from './src/components/BusinessListingSearch';
|
|
47
|
+
import { LastOrders } from './src/components/LastOrders';
|
|
48
|
+
import NavBar from './src/components/NavBar';
|
|
49
|
+
import { BusinessTypeFilter } from './src/components/BusinessTypeFilter';
|
|
50
|
+
import { BusinessController } from './src/components/BusinessController';
|
|
51
|
+
import { BusinessFeaturedController } from './src/components/BusinessFeaturedController';
|
|
52
|
+
import { HighestRatedBusinesses } from './src/components/HighestRatedBusinesses';
|
|
47
53
|
|
|
48
54
|
import { Toast } from './src/components/shared/OToast';
|
|
49
55
|
import {
|
|
@@ -60,7 +66,7 @@ import {
|
|
|
60
66
|
OAlert,
|
|
61
67
|
OModal,
|
|
62
68
|
OBottomPopup,
|
|
63
|
-
|
|
69
|
+
HeaderTitle
|
|
64
70
|
} from './src/components/shared';
|
|
65
71
|
|
|
66
72
|
import { Container } from './src/layouts/Container';
|
|
@@ -119,6 +125,11 @@ export {
|
|
|
119
125
|
BusinessProductsList,
|
|
120
126
|
FloatingButton,
|
|
121
127
|
SearchBar,
|
|
128
|
+
LastOrders,
|
|
129
|
+
BusinessTypeFilter,
|
|
130
|
+
BusinessController,
|
|
131
|
+
BusinessFeaturedController,
|
|
132
|
+
HighestRatedBusinesses,
|
|
122
133
|
|
|
123
134
|
// OComponents
|
|
124
135
|
Toast,
|
|
@@ -135,11 +146,12 @@ export {
|
|
|
135
146
|
OAlert,
|
|
136
147
|
OModal,
|
|
137
148
|
OBottomPopup,
|
|
138
|
-
|
|
149
|
+
HeaderTitle,
|
|
139
150
|
|
|
140
151
|
// layout
|
|
141
152
|
Container,
|
|
142
153
|
SafeAreaContainer,
|
|
154
|
+
NavBar,
|
|
143
155
|
|
|
144
156
|
// utils
|
|
145
157
|
_retrieveStoreData,
|
|
@@ -4,9 +4,7 @@ import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
|
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { OIcon, OText, OModal } from '../shared';
|
|
6
6
|
import { BusinessBasicInformationParams } from '../../types';
|
|
7
|
-
import { convertHoursToMinutes
|
|
8
|
-
import { BusinessInformation } from '../BusinessInformation';
|
|
9
|
-
import { BusinessReviews } from '../BusinessReviews';
|
|
7
|
+
import { convertHoursToMinutes } from '../../utils';
|
|
10
8
|
import dayjs from 'dayjs';
|
|
11
9
|
import timezone from 'dayjs/plugin/timezone';
|
|
12
10
|
import isBetween from 'dayjs/plugin/isBetween';
|
|
@@ -28,6 +26,9 @@ import {
|
|
|
28
26
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
29
27
|
const types = ['food', 'laundry', 'alcohol', 'groceries'];
|
|
30
28
|
|
|
29
|
+
let BusinessInformation: null | React.ElementType = null
|
|
30
|
+
let BusinessReviews: null | React.ElementType = null
|
|
31
|
+
|
|
31
32
|
export const BusinessBasicInformation = (
|
|
32
33
|
props: BusinessBasicInformationParams,
|
|
33
34
|
) => {
|
|
@@ -40,6 +41,25 @@ export const BusinessBasicInformation = (
|
|
|
40
41
|
const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
|
|
41
42
|
const [openBusinessInformation, setOpenBusinessInformation] = useState(false);
|
|
42
43
|
const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
|
|
44
|
+
const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
|
|
45
|
+
const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
|
|
46
|
+
|
|
47
|
+
const handleClickBusinessInformation = () => {
|
|
48
|
+
if (!businessInformationObtained) {
|
|
49
|
+
BusinessInformation = require('../BusinessInformation').BusinessInformation
|
|
50
|
+
setBusinessInformationObtained(true)
|
|
51
|
+
}
|
|
52
|
+
setOpenBusinessInformation(true)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const handleClickBusinessReviews = () => {
|
|
56
|
+
if (!businessReviewsObtained) {
|
|
57
|
+
BusinessReviews = require('../BusinessReviews').BusinessReviews
|
|
58
|
+
setBusinessReviewsObtainedbtained(true)
|
|
59
|
+
}
|
|
60
|
+
setOpenBusinessReviews(true)
|
|
61
|
+
}
|
|
62
|
+
|
|
43
63
|
const getBusinessType = () => {
|
|
44
64
|
if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
|
|
45
65
|
const _types: any = [];
|
|
@@ -53,7 +73,7 @@ export const BusinessBasicInformation = (
|
|
|
53
73
|
return _types.join(', ');
|
|
54
74
|
};
|
|
55
75
|
|
|
56
|
-
|
|
76
|
+
|
|
57
77
|
useEffect(() => {
|
|
58
78
|
if (businessState?.loading) return
|
|
59
79
|
let timeout: any = null
|
|
@@ -67,16 +87,16 @@ export const BusinessBasicInformation = (
|
|
|
67
87
|
})
|
|
68
88
|
}
|
|
69
89
|
if (lapse) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
90
|
+
const to = currentDate.hour(lapse.close.hour).minute(lapse.close.minute)
|
|
91
|
+
const timeToClose = (to.unix() - currentDate.unix()) * 1000
|
|
92
|
+
timeout = setTimeout(() => {
|
|
93
|
+
navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })
|
|
94
|
+
}, timeToClose)
|
|
75
95
|
}
|
|
76
96
|
return () => {
|
|
77
|
-
|
|
97
|
+
timeout && clearTimeout(timeout)
|
|
78
98
|
}
|
|
79
|
-
|
|
99
|
+
}, [businessState?.business])
|
|
80
100
|
|
|
81
101
|
return (
|
|
82
102
|
<BusinessContainer>
|
|
@@ -92,7 +112,7 @@ export const BusinessBasicInformation = (
|
|
|
92
112
|
optimizeImage(businessState?.business?.header, 'h_250,c_limit'),
|
|
93
113
|
}}>
|
|
94
114
|
{!isBusinessInfoShow && (
|
|
95
|
-
<WrapBusinessInfo onPress={() =>
|
|
115
|
+
<WrapBusinessInfo onPress={() => handleClickBusinessInformation()}>
|
|
96
116
|
<OIcon src={theme.images.general.info} width={24} />
|
|
97
117
|
</WrapBusinessInfo>
|
|
98
118
|
)}
|
|
@@ -203,17 +223,17 @@ export const BusinessBasicInformation = (
|
|
|
203
223
|
<WrapReviews>
|
|
204
224
|
{!isBusinessInfoShow && (
|
|
205
225
|
<>
|
|
206
|
-
{
|
|
226
|
+
{isPreOrder && (
|
|
207
227
|
<>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
228
|
+
<TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
|
|
229
|
+
<OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
|
|
230
|
+
{t('PRE_ORDER', 'Preorder')}
|
|
231
|
+
</OText>
|
|
232
|
+
</TouchableOpacity>
|
|
233
|
+
<OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
|
|
214
234
|
</>
|
|
215
235
|
)}
|
|
216
|
-
<TouchableOpacity onPress={() =>
|
|
236
|
+
<TouchableOpacity onPress={() => handleClickBusinessReviews()}>
|
|
217
237
|
<OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
|
|
218
238
|
{t('REVIEWS', 'Reviews')}
|
|
219
239
|
</OText>
|
|
@@ -222,28 +242,37 @@ export const BusinessBasicInformation = (
|
|
|
222
242
|
)}
|
|
223
243
|
</WrapReviews>
|
|
224
244
|
</BusinessInfo>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
{businessInformationObtained ? (
|
|
246
|
+
<OModal
|
|
247
|
+
titleSectionStyle={styles.modalTitleSectionStyle}
|
|
248
|
+
open={openBusinessInformation}
|
|
249
|
+
onClose={() => setOpenBusinessInformation(false)}
|
|
250
|
+
isNotDecoration>
|
|
251
|
+
{BusinessInformation && (
|
|
252
|
+
<BusinessInformation
|
|
253
|
+
businessState={businessState}
|
|
254
|
+
business={business}
|
|
255
|
+
/>
|
|
256
|
+
)}
|
|
257
|
+
</OModal>
|
|
258
|
+
) : null}
|
|
259
|
+
{businessReviewsObtained ? (
|
|
260
|
+
<OModal
|
|
261
|
+
entireModal
|
|
262
|
+
titleSectionStyle={styles.modalTitleSectionStyle}
|
|
263
|
+
open={openBusinessReviews}
|
|
264
|
+
onClose={() => setOpenBusinessReviews(false)}
|
|
265
|
+
isNotDecoration
|
|
266
|
+
>
|
|
267
|
+
{BusinessReviews && (
|
|
268
|
+
<BusinessReviews
|
|
269
|
+
businessState={businessState}
|
|
270
|
+
businessId={business.id}
|
|
271
|
+
reviews={business.reviews?.reviews}
|
|
272
|
+
/>
|
|
273
|
+
)}
|
|
274
|
+
</OModal>
|
|
275
|
+
) : null}
|
|
247
276
|
</BusinessContainer>
|
|
248
277
|
);
|
|
249
278
|
};
|
|
@@ -43,6 +43,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
43
43
|
} = props;
|
|
44
44
|
const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
|
|
45
45
|
const [orderState] = useOrder();
|
|
46
|
+
const [configState] = useConfig();
|
|
46
47
|
const [, t] = useLanguage();
|
|
47
48
|
const theme = useTheme()
|
|
48
49
|
const styles = StyleSheet.create({
|
|
@@ -135,7 +136,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
135
136
|
</View>
|
|
136
137
|
)}
|
|
137
138
|
<BusinessState>
|
|
138
|
-
{!isBusinessOpen && (
|
|
139
|
+
{!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
|
|
139
140
|
<View style={styles.businessStateView}>
|
|
140
141
|
<OText
|
|
141
142
|
color={theme.colors.textThird}
|
|
@@ -44,11 +44,11 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
44
44
|
borderTopStartRadius: 4,
|
|
45
45
|
borderTopEndRadius: 4,
|
|
46
46
|
backgroundColor: theme.colors.textPrimary,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
},
|
|
48
|
+
tabDeactived: {
|
|
49
49
|
marginTop: 10,
|
|
50
50
|
height: 4
|
|
51
|
-
|
|
51
|
+
}
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const handleCategoryScroll = (category: any) => {
|
|
@@ -112,7 +112,9 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
112
112
|
categories.map((category: any) => (
|
|
113
113
|
<Tab
|
|
114
114
|
key={category.id}
|
|
115
|
-
onPress={() =>
|
|
115
|
+
onPress={() => requestAnimationFrame(() => {
|
|
116
|
+
handleCategoryScroll(category)
|
|
117
|
+
})}
|
|
116
118
|
style={[
|
|
117
119
|
category.id === 'featured' && !featured && styles.featuredStyle,
|
|
118
120
|
{
|
|
@@ -45,7 +45,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<ProductsContainer>
|
|
48
|
+
<ProductsContainer renderToHardwareTextureAndroid={categoryState.loading || isBusinessLoading}>
|
|
49
49
|
{category.id &&
|
|
50
50
|
categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
|
|
51
51
|
<SingleProductCard
|
|
@@ -312,16 +312,18 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
312
312
|
{!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
|
|
313
313
|
<FloatingButton
|
|
314
314
|
btnText={
|
|
315
|
-
|
|
316
|
-
? t('
|
|
317
|
-
:
|
|
315
|
+
openUpselling
|
|
316
|
+
? t('LOADING', 'Loading')
|
|
317
|
+
: currentCart?.subtotal >= currentCart?.minimum
|
|
318
|
+
? t('VIEW_ORDER', 'View Order')
|
|
319
|
+
: `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
|
|
318
320
|
}
|
|
319
|
-
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum}
|
|
321
|
+
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
320
322
|
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
321
323
|
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
322
324
|
btnLeftValue={currentCart?.products?.length}
|
|
323
325
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
324
|
-
disabled={currentCart?.subtotal < currentCart?.minimum}
|
|
326
|
+
disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
325
327
|
handleClick={() => setOpenUpselling(true)}
|
|
326
328
|
/>
|
|
327
329
|
)}
|
|
@@ -446,8 +446,6 @@ const CartUI = (props: any) => {
|
|
|
446
446
|
open={openTaxModal.open}
|
|
447
447
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
448
448
|
entireModal
|
|
449
|
-
title={`${openTaxModal.data?.name ||
|
|
450
|
-
t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
|
|
451
449
|
>
|
|
452
450
|
<TaxInformation
|
|
453
451
|
type={openTaxModal.type}
|
|
@@ -1025,8 +1025,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1025
1025
|
open={openTaxModal.open}
|
|
1026
1026
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
1027
1027
|
entireModal
|
|
1028
|
-
title={`${openTaxModal.data?.name ||
|
|
1029
|
-
t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
|
|
1030
1028
|
>
|
|
1031
1029
|
<TaxInformation
|
|
1032
1030
|
type={openTaxModal.type}
|
|
@@ -98,7 +98,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
98
98
|
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
|
|
99
99
|
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
|
|
100
100
|
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
|
|
101
|
-
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY
|
|
101
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
|
|
102
102
|
]
|
|
103
103
|
|
|
104
104
|
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
@@ -131,7 +131,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
131
131
|
|
|
132
132
|
useEffect(() => {
|
|
133
133
|
if (isFocused) {
|
|
134
|
-
loadOrders()
|
|
134
|
+
loadOrders(false, false, false, true)
|
|
135
135
|
}
|
|
136
136
|
}, [isFocused])
|
|
137
137
|
|
|
@@ -202,7 +202,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
202
202
|
<OSRow>
|
|
203
203
|
<OText size={12} numberOfLines={1}>
|
|
204
204
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
205
|
-
({parsePrice(fee?.fixed)} + {fee
|
|
205
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%)
|
|
206
206
|
</OText>
|
|
207
207
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
|
|
208
208
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -126,7 +126,9 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
126
126
|
|
|
127
127
|
useEffect(() => {
|
|
128
128
|
if (props.paySelected && props.paySelected?.data) {
|
|
129
|
-
|
|
129
|
+
requestAnimationFrame(() => {
|
|
130
|
+
setPaymethodData && setPaymethodData(props.paySelected?.data)
|
|
131
|
+
})
|
|
130
132
|
}
|
|
131
133
|
}, [props.paySelected])
|
|
132
134
|
|
|
@@ -143,18 +143,20 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
|
143
143
|
</OText>
|
|
144
144
|
</Information>
|
|
145
145
|
<Status>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
146
|
+
{order.cart && (
|
|
147
|
+
<OButton
|
|
148
|
+
text={t('REORDER', 'Reorder')}
|
|
149
|
+
imgRightSrc={''}
|
|
150
|
+
textStyle={styles.buttonText}
|
|
151
|
+
style={
|
|
152
|
+
reorderLoading && order.id === reorderSelected
|
|
153
|
+
? styles.reorderLoading
|
|
154
|
+
: styles.reorderbutton
|
|
155
|
+
}
|
|
156
|
+
onClick={() => handleReorderClick(order.id)}
|
|
157
|
+
isLoading={reorderLoading && order.id === reorderSelected}
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
158
160
|
{allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
159
161
|
!order.review && (
|
|
160
162
|
<TouchableOpacity
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { useLanguage } from 'ordering-components/native'
|
|
2
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
3
3
|
import { SingleProductCard } from '../SingleProductCard'
|
|
4
4
|
import { TaxInformationContainer, ProductContainer } from './styles'
|
|
5
5
|
import { OText } from '../shared'
|
|
@@ -13,8 +13,9 @@ interface taxInformationParams {
|
|
|
13
13
|
fixed?: number,
|
|
14
14
|
percentage?: number,
|
|
15
15
|
id: number,
|
|
16
|
-
discounts?: any
|
|
17
|
-
|
|
16
|
+
discounts?: any,
|
|
17
|
+
rate_type?: number
|
|
18
|
+
},
|
|
18
19
|
products: Array<any>,
|
|
19
20
|
type: string
|
|
20
21
|
}
|
|
@@ -27,6 +28,7 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
27
28
|
} = props
|
|
28
29
|
|
|
29
30
|
const [, t] = useLanguage()
|
|
31
|
+
const [{ parsePrice }] = useUtils()
|
|
30
32
|
|
|
31
33
|
const includedOnPriceString = data?.type === 1 ? `(${t('INCLUDED_ON_PRICE', 'Included on price')})` : `(${t('NOT_INCLUDED_ON_PRICE', 'Not included on price')})`
|
|
32
34
|
const offersHideArray = ['offer_target_2', 'offer_target_3']
|
|
@@ -56,8 +58,12 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
56
58
|
|
|
57
59
|
return (
|
|
58
60
|
<TaxInformationContainer>
|
|
61
|
+
<OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
|
|
62
|
+
{`${data?.name ||
|
|
63
|
+
t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${data?.rate_type !== 2 ? `(${typeof data?.rate === 'number' ? `${data?.rate}%` : `${parsePrice(data?.fixed ?? 0)} + ${data?.percentage}%`})` : ''} `}
|
|
64
|
+
</OText>
|
|
59
65
|
{!!data?.description ? (
|
|
60
|
-
<OText size={
|
|
66
|
+
<OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
|
|
61
67
|
{t('DESCRIPTION', 'Description')}: {data?.description} {data?.type && !type?.includes('offer') && includedOnPriceString}
|
|
62
68
|
</OText>
|
|
63
69
|
) : (
|