ordering-ui-react-native 0.15.43 → 0.15.46
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/PreviousOrders/index.tsx +4 -5
- 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/Checkout/index.tsx +2 -1
- 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/PaymentOptionWallet/index.tsx +6 -2
- 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
|
@@ -99,7 +99,6 @@ export const PreviousOrders = (props: any) => {
|
|
|
99
99
|
},
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
|
|
103
102
|
const getDelayMinutes = (order: any) => {
|
|
104
103
|
// targetMin = delivery_datetime + eta_time - now()
|
|
105
104
|
const offset = 300
|
|
@@ -108,7 +107,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
108
107
|
? parseDate(order?.delivery_datetime_utc)
|
|
109
108
|
: parseDate(cdtToutc)
|
|
110
109
|
const _eta = order?.eta_time
|
|
111
|
-
return moment(_delivery
|
|
110
|
+
return moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'minutes')
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
const displayDelayedTime = (order: any) => {
|
|
@@ -116,10 +115,10 @@ export const PreviousOrders = (props: any) => {
|
|
|
116
115
|
// get day, hour and minutes
|
|
117
116
|
const sign = tagetedMin >= 0 ? '' : '- '
|
|
118
117
|
tagetedMin = Math.abs(tagetedMin)
|
|
119
|
-
let day = Math.floor(tagetedMin / 1440)
|
|
118
|
+
let day: string | number = Math.floor(tagetedMin / 1440)
|
|
120
119
|
const restMinOfTargetedMin = tagetedMin - 1440 * day
|
|
121
|
-
let restHours = Math.floor(restMinOfTargetedMin / 60)
|
|
122
|
-
let restMins = restMinOfTargetedMin - 60 * restHours
|
|
120
|
+
let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
|
|
121
|
+
let restMins: string | number = restMinOfTargetedMin - 60 * restHours
|
|
123
122
|
// make standard time format
|
|
124
123
|
day = day === 0 ? '' : day + 'day '
|
|
125
124
|
restHours = restHours < 10 ? '0' + restHours : restHours
|
|
@@ -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}
|
|
@@ -554,11 +554,12 @@ const CheckoutUI = (props: any) => {
|
|
|
554
554
|
</ChSection>
|
|
555
555
|
)}
|
|
556
556
|
|
|
557
|
-
{!cartState.loading && cart && isWalletEnabled && (
|
|
557
|
+
{!cartState.loading && cart && isWalletEnabled && businessDetails?.business?.configs && (
|
|
558
558
|
<WalletPaymentOptionContainer>
|
|
559
559
|
<PaymentOptionWallet
|
|
560
560
|
cart={cart}
|
|
561
561
|
businessId={cart?.business_id}
|
|
562
|
+
businessConfigs={businessDetails?.business?.configs}
|
|
562
563
|
/>
|
|
563
564
|
</WalletPaymentOptionContainer>
|
|
564
565
|
)}
|
|
@@ -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
|
|
|
@@ -20,6 +20,7 @@ import { OText } from '../shared'
|
|
|
20
20
|
|
|
21
21
|
const PaymentOptionWalletUI = (props: any) => {
|
|
22
22
|
const {
|
|
23
|
+
businessConfigs,
|
|
23
24
|
businessId,
|
|
24
25
|
walletsState,
|
|
25
26
|
selectWallet,
|
|
@@ -37,6 +38,9 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
37
38
|
const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
|
|
38
39
|
const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
|
|
39
40
|
|
|
41
|
+
const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
42
|
+
const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
43
|
+
|
|
40
44
|
const styles = StyleSheet.create({
|
|
41
45
|
checkBoxStyle: {
|
|
42
46
|
width: 25,
|
|
@@ -53,11 +57,11 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
53
57
|
const walletName: any = {
|
|
54
58
|
cash: {
|
|
55
59
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
56
|
-
isActive: isWalletCashEnabled
|
|
60
|
+
isActive: isWalletCashEnabled && isBusinessWalletCashEnabled
|
|
57
61
|
},
|
|
58
62
|
credit_point: {
|
|
59
63
|
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
60
|
-
isActive: isWalletPointsEnabled
|
|
64
|
+
isActive: isWalletPointsEnabled && isBusinessWalletPointsEnabled
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
|
|
@@ -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
|
) : (
|