ordering-ui-react-native 0.15.40 → 0.15.43
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/src/pages/BusinessProductsList.tsx +1 -0
- 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 +2 -0
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +27 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +26 -4
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +20 -1
- package/themes/original/src/components/BusinessProductsList/styles.tsx +20 -1
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Messages/index.tsx +5 -0
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/OrderSummary/index.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +39 -18
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/UserProfile/index.tsx +3 -3
- package/themes/original/src/components/shared/HeaderTitle.tsx +20 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/utils/index.tsx +9 -0
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>
|
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
OAlert,
|
|
61
61
|
OModal,
|
|
62
62
|
OBottomPopup,
|
|
63
|
+
HeaderTitle
|
|
63
64
|
} from './src/components/shared';
|
|
64
65
|
|
|
65
66
|
import { Container } from './src/layouts/Container';
|
|
@@ -134,6 +135,7 @@ export {
|
|
|
134
135
|
OAlert,
|
|
135
136
|
OModal,
|
|
136
137
|
OBottomPopup,
|
|
138
|
+
HeaderTitle,
|
|
137
139
|
|
|
138
140
|
// layout
|
|
139
141
|
Container,
|
|
@@ -108,6 +108,9 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
108
108
|
top: 12,
|
|
109
109
|
zIndex: 1002,
|
|
110
110
|
},
|
|
111
|
+
wrapperNavbar: Platform.OS === 'ios'
|
|
112
|
+
? { paddingVertical: 0, paddingHorizontal: 40 }
|
|
113
|
+
: { paddingVertical: 20, paddingHorizontal: 40 }
|
|
111
114
|
});
|
|
112
115
|
|
|
113
116
|
const [, t] = useLanguage();
|
|
@@ -500,16 +503,18 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
500
503
|
keyboardShouldPersistTaps='always'
|
|
501
504
|
listViewDisplayed={false}
|
|
502
505
|
>
|
|
503
|
-
<
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
506
|
+
<View style={styles.wrapperNavbar}>
|
|
507
|
+
<NavBar
|
|
508
|
+
title={t('WHERE_DO_WE_DELIVERY', 'Where do we delivery?')}
|
|
509
|
+
titleAlign={'center'}
|
|
510
|
+
onActionLeft={goToBack}
|
|
511
|
+
showCall={false}
|
|
512
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
513
|
+
style={{ flexDirection: 'column', alignItems: 'flex-start' }}
|
|
514
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
515
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
516
|
+
/>
|
|
517
|
+
</View>
|
|
513
518
|
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
|
514
519
|
<AddressFormContainer style={{ height: 600, overflow: 'scroll' }}>
|
|
515
520
|
<View>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
2
|
import { AddressList as AddressListController, useLanguage, useOrder, useSession } from 'ordering-components/native'
|
|
3
3
|
import { AddressListContainer, AddressItem } from './styles'
|
|
4
|
-
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
import { Platform, StyleSheet, View } from 'react-native'
|
|
5
5
|
import { OButton, OText, OAlert, OModal, OIcon } from '../shared'
|
|
6
6
|
import { Container } from '../../layouts/Container'
|
|
7
7
|
import { AddressListParams } from '../../types'
|
|
@@ -261,6 +261,32 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
261
261
|
)}
|
|
262
262
|
{!addressList.loading && !addressList.error && (
|
|
263
263
|
<>
|
|
264
|
+
{addressList?.addresses?.length === 0 && (
|
|
265
|
+
<View
|
|
266
|
+
style={{
|
|
267
|
+
flexDirection: 'column',
|
|
268
|
+
paddingHorizontal: 10,
|
|
269
|
+
paddingTop: 20
|
|
270
|
+
}}
|
|
271
|
+
>
|
|
272
|
+
<OText
|
|
273
|
+
size={24}
|
|
274
|
+
lineHeight={36}
|
|
275
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
276
|
+
style={{
|
|
277
|
+
textAlign: 'center',
|
|
278
|
+
marginRight: 40,
|
|
279
|
+
color: theme.colors.textNormal,
|
|
280
|
+
paddingHorizontal: 0,
|
|
281
|
+
width: '100%',
|
|
282
|
+
marginLeft: 0
|
|
283
|
+
}}
|
|
284
|
+
>
|
|
285
|
+
{t('ADDRESS_LIST', 'Address List')}
|
|
286
|
+
</OText>
|
|
287
|
+
</View>
|
|
288
|
+
)}
|
|
289
|
+
|
|
264
290
|
<OButton
|
|
265
291
|
text={t('ADD_NEW_ADDRESS', 'Add new Address')}
|
|
266
292
|
imgRightSrc=''
|
|
@@ -4,7 +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 } from '../../utils';
|
|
7
|
+
import { convertHoursToMinutes, shape } from '../../utils';
|
|
8
8
|
import { BusinessInformation } from '../BusinessInformation';
|
|
9
9
|
import { BusinessReviews } from '../BusinessReviews';
|
|
10
10
|
import dayjs from 'dayjs';
|
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
BusinessInfoItem,
|
|
23
23
|
WrapReviews,
|
|
24
24
|
WrapBusinessInfo,
|
|
25
|
+
TitleWrapper,
|
|
26
|
+
RibbonBox
|
|
25
27
|
} from './styles';
|
|
26
28
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
27
29
|
const types = ['food', 'laundry', 'alcohol', 'groceries'];
|
|
@@ -121,9 +123,29 @@ export const BusinessBasicInformation = (
|
|
|
121
123
|
<PlaceholderLine height={30} width={20} />
|
|
122
124
|
</Placeholder>
|
|
123
125
|
) : (
|
|
124
|
-
<
|
|
125
|
-
{
|
|
126
|
-
|
|
126
|
+
<TitleWrapper>
|
|
127
|
+
<OText size={24} weight={'600'}>
|
|
128
|
+
{business?.name}
|
|
129
|
+
</OText>
|
|
130
|
+
{business?.ribbon?.enabled && (
|
|
131
|
+
<RibbonBox
|
|
132
|
+
bgColor={business?.ribbon?.color}
|
|
133
|
+
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
134
|
+
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
135
|
+
>
|
|
136
|
+
<OText
|
|
137
|
+
size={10}
|
|
138
|
+
weight={'400'}
|
|
139
|
+
color={theme.colors.white}
|
|
140
|
+
numberOfLines={2}
|
|
141
|
+
ellipsizeMode='tail'
|
|
142
|
+
lineHeight={13}
|
|
143
|
+
>
|
|
144
|
+
{business?.ribbon?.text}
|
|
145
|
+
</OText>
|
|
146
|
+
</RibbonBox>
|
|
147
|
+
)}
|
|
148
|
+
</TitleWrapper>
|
|
127
149
|
)}
|
|
128
150
|
</BusinessInfoItem>
|
|
129
151
|
{loading ? (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
1
|
+
import styled, { css } from 'styled-components/native';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
|
|
4
4
|
export const BusinessContainer = styled.View`
|
|
@@ -41,3 +41,30 @@ export const WrapBusinessInfo = styled.TouchableOpacity`
|
|
|
41
41
|
top: 16px;
|
|
42
42
|
end: 39px;
|
|
43
43
|
`;
|
|
44
|
+
|
|
45
|
+
export const TitleWrapper = styled.View`
|
|
46
|
+
width: 100%;
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
`
|
|
51
|
+
|
|
52
|
+
export const RibbonBox = styled.View`
|
|
53
|
+
margin-left: 5px;
|
|
54
|
+
background-color: ${(props: any) => props.theme.colors.primary};
|
|
55
|
+
padding: 2px 8px;
|
|
56
|
+
max-width: 180px;
|
|
57
|
+
align-self: flex-start;
|
|
58
|
+
|
|
59
|
+
${(props: any) => props.bgColor && css`
|
|
60
|
+
background-color: ${props.bgColor};
|
|
61
|
+
`}
|
|
62
|
+
|
|
63
|
+
${(props: any) => props.isRoundRect && css`
|
|
64
|
+
border-radius: 7.6px;
|
|
65
|
+
`}
|
|
66
|
+
|
|
67
|
+
${(props: any) => props.isCapsule && css`
|
|
68
|
+
border-radius: 50px;
|
|
69
|
+
`}
|
|
70
|
+
`
|
|
@@ -111,7 +111,7 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
111
111
|
categories.length &&
|
|
112
112
|
categories.map((category: any) => (
|
|
113
113
|
<Tab
|
|
114
|
-
key={category.
|
|
114
|
+
key={category.id}
|
|
115
115
|
onPress={() => handleCategoryScroll(category)}
|
|
116
116
|
style={[
|
|
117
117
|
category.id === 'featured' && !featured && styles.featuredStyle,
|
|
@@ -4,11 +4,12 @@ import { SingleProductCard } from '../SingleProductCard';
|
|
|
4
4
|
import { NotFoundSource } from '../NotFoundSource';
|
|
5
5
|
import { BusinessProductsListParams } from '../../types';
|
|
6
6
|
import { OButton, OIcon, OModal, OText } from '../shared';
|
|
7
|
-
import { ProductsContainer, ErrorMessage, WrapperNotFound } from './styles';
|
|
7
|
+
import { ProductsContainer, ErrorMessage, WrapperNotFound, RibbonBox } from './styles';
|
|
8
8
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
9
9
|
import { View, ScrollView } from 'react-native';
|
|
10
10
|
import { StyleSheet } from 'react-native';
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
12
|
+
import { shape } from '../../utils'
|
|
12
13
|
|
|
13
14
|
const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
14
15
|
const {
|
|
@@ -110,6 +111,24 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
110
111
|
<OText size={16} weight="600">
|
|
111
112
|
{category.name}
|
|
112
113
|
</OText>
|
|
114
|
+
{category?.ribbon?.enabled && (
|
|
115
|
+
<RibbonBox
|
|
116
|
+
bgColor={category?.ribbon?.color}
|
|
117
|
+
isRoundRect={category?.ribbon?.shape === shape?.rectangleRound}
|
|
118
|
+
isCapsule={category?.ribbon?.shape === shape?.capsuleShape}
|
|
119
|
+
>
|
|
120
|
+
<OText
|
|
121
|
+
size={10}
|
|
122
|
+
weight={'400'}
|
|
123
|
+
color={theme.colors.white}
|
|
124
|
+
numberOfLines={2}
|
|
125
|
+
ellipsizeMode='tail'
|
|
126
|
+
lineHeight={13}
|
|
127
|
+
>
|
|
128
|
+
{category?.ribbon?.text}
|
|
129
|
+
</OText>
|
|
130
|
+
</RibbonBox>
|
|
131
|
+
)}
|
|
113
132
|
</View>
|
|
114
133
|
{!!category?.description && (
|
|
115
134
|
<View style={{ position: 'relative' }}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const ProductsContainer = styled.View`
|
|
4
4
|
`
|
|
@@ -11,4 +11,23 @@ export const ErrorMessage = styled.View`
|
|
|
11
11
|
|
|
12
12
|
export const WrapperNotFound = styled.View`
|
|
13
13
|
height: 500px;
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export const RibbonBox = styled.View`
|
|
17
|
+
margin-left: 5px;
|
|
18
|
+
background-color: ${(props: any) => props.theme.colors.primary};
|
|
19
|
+
padding: 2px 8px;
|
|
20
|
+
max-width: 180px;
|
|
21
|
+
|
|
22
|
+
${(props: any) => props.bgColor && css`
|
|
23
|
+
background-color: ${props.bgColor};
|
|
24
|
+
`}
|
|
25
|
+
|
|
26
|
+
${(props: any) => props.isRoundRect && css`
|
|
27
|
+
border-radius: 7.6px;
|
|
28
|
+
`}
|
|
29
|
+
|
|
30
|
+
${(props: any) => props.isCapsule && css`
|
|
31
|
+
border-radius: 50px;
|
|
32
|
+
`}
|
|
14
33
|
`
|
|
@@ -22,9 +22,9 @@ export const CartContent = (props: any) => {
|
|
|
22
22
|
<CCContainer>
|
|
23
23
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
24
24
|
<>
|
|
25
|
-
<OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
|
|
25
|
+
{/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
|
|
26
26
|
{carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
|
|
27
|
-
</OText>
|
|
27
|
+
</OText> */}
|
|
28
28
|
{carts.map((cart: any, i: number) => (
|
|
29
29
|
<CCList key={i} style={{ overflow: 'visible' }}>
|
|
30
30
|
{cart.products.length > 0 && (
|
|
@@ -540,6 +540,11 @@ const styles = StyleSheet.create({
|
|
|
540
540
|
|
|
541
541
|
export const Messages = (props: MessagesParams) => {
|
|
542
542
|
const [allMessages, setAllMessages] = useState(props.messages)
|
|
543
|
+
|
|
544
|
+
useEffect(() => {
|
|
545
|
+
setAllMessages(props.messages)
|
|
546
|
+
}, [props.messages])
|
|
547
|
+
|
|
543
548
|
const MessagesProps = {
|
|
544
549
|
...props,
|
|
545
550
|
UIComponent: MessagesUI,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
1
|
import styled, { css } from 'styled-components/native'
|
|
3
2
|
|
|
4
|
-
|
|
5
3
|
export const Wrapper = styled.View`
|
|
6
4
|
flex: 1;
|
|
7
5
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
@@ -39,4 +37,4 @@ export const MessageTypeItem = styled.View`
|
|
|
39
37
|
${({ active }: any) => active && css`
|
|
40
38
|
background-color: ${(props: any) => props.theme.colors.whiteGray};
|
|
41
39
|
`}
|
|
42
|
-
`
|
|
40
|
+
`
|
|
@@ -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} />
|
|
@@ -7,10 +7,11 @@ import {
|
|
|
7
7
|
} from 'ordering-components/native';
|
|
8
8
|
import { useTheme } from 'styled-components/native';
|
|
9
9
|
import { SingleProductCardParams } from '../../types';
|
|
10
|
-
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer } from './styles';
|
|
10
|
+
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
|
|
11
11
|
import { StyleSheet } from 'react-native';
|
|
12
12
|
import { OText, OIcon } from '../shared';
|
|
13
13
|
import FastImage from 'react-native-fast-image'
|
|
14
|
+
import { shape } from '../../utils';
|
|
14
15
|
|
|
15
16
|
export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
16
17
|
const {
|
|
@@ -46,8 +47,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
46
47
|
productStyle: {
|
|
47
48
|
width: 75,
|
|
48
49
|
height: 75,
|
|
49
|
-
borderRadius: 7.6
|
|
50
|
-
marginStart: 12
|
|
50
|
+
borderRadius: 7.6
|
|
51
51
|
},
|
|
52
52
|
quantityContainer: {
|
|
53
53
|
position: 'absolute',
|
|
@@ -136,21 +136,42 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
136
136
|
{product?.description}
|
|
137
137
|
</OText>
|
|
138
138
|
</CardInfo>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
139
|
+
<LogoWrapper>
|
|
140
|
+
{product?.ribbon?.enabled && (
|
|
141
|
+
<RibbonBox
|
|
142
|
+
bgColor={product?.ribbon?.color}
|
|
143
|
+
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
144
|
+
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
145
|
+
>
|
|
146
|
+
<OText
|
|
147
|
+
size={10}
|
|
148
|
+
weight={'400'}
|
|
149
|
+
color={theme.colors.white}
|
|
150
|
+
numberOfLines={2}
|
|
151
|
+
ellipsizeMode='tail'
|
|
152
|
+
lineHeight={13}
|
|
153
|
+
>
|
|
154
|
+
{product?.ribbon?.text}
|
|
155
|
+
</OText>
|
|
156
|
+
</RibbonBox>
|
|
157
|
+
)}
|
|
158
|
+
{product?.images ? (
|
|
159
|
+
<FastImage
|
|
160
|
+
style={styles.productStyle}
|
|
161
|
+
source={{
|
|
162
|
+
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
163
|
+
priority: FastImage.priority.normal,
|
|
164
|
+
}}
|
|
165
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
166
|
+
/>
|
|
167
|
+
) : (
|
|
168
|
+
<OIcon
|
|
169
|
+
src={theme?.images?.dummies?.product}
|
|
170
|
+
style={styles.productStyle}
|
|
171
|
+
/>
|
|
172
|
+
)}
|
|
173
|
+
</LogoWrapper>
|
|
174
|
+
|
|
154
175
|
{(isSoldOut || maxProductQuantity <= 0) && (
|
|
155
176
|
<SoldOut>
|
|
156
177
|
<OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const CardContainer = styled.TouchableOpacity`
|
|
4
4
|
flex: 1;
|
|
@@ -31,3 +31,30 @@ export const PricesContainer = styled.View`
|
|
|
31
31
|
flex-direction: row;
|
|
32
32
|
align-items: center;
|
|
33
33
|
`
|
|
34
|
+
|
|
35
|
+
export const LogoWrapper = styled.View`
|
|
36
|
+
position: relative;
|
|
37
|
+
margin-left: 12px;
|
|
38
|
+
`
|
|
39
|
+
|
|
40
|
+
export const RibbonBox = styled.View`
|
|
41
|
+
position: absolute;
|
|
42
|
+
z-index: 1;
|
|
43
|
+
top: -4px;
|
|
44
|
+
right: -4px;
|
|
45
|
+
background-color: ${(props: any) => props.theme.colors.primary};
|
|
46
|
+
padding: 1px 8px;
|
|
47
|
+
max-width: 60px;
|
|
48
|
+
|
|
49
|
+
${(props: any) => props.bgColor && css`
|
|
50
|
+
background-color: ${props.bgColor};
|
|
51
|
+
`}
|
|
52
|
+
|
|
53
|
+
${(props: any) => props.isRoundRect && css`
|
|
54
|
+
border-radius: 7.6px;
|
|
55
|
+
`}
|
|
56
|
+
|
|
57
|
+
${(props: any) => props.isCapsule && css`
|
|
58
|
+
border-radius: 50px;
|
|
59
|
+
`}
|
|
60
|
+
`
|
|
@@ -136,10 +136,10 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
return (
|
|
139
|
-
<View style={{ flex: 1, height: height - top - bottom - 62 }}>
|
|
140
|
-
<OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
|
|
139
|
+
<View style={{ flex: 1, height: height - top - bottom - 62, paddingTop: 20 }}>
|
|
140
|
+
{/* <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
|
|
141
141
|
{t('PROFILE', 'Profile')}
|
|
142
|
-
</OText>
|
|
142
|
+
</OText> */}
|
|
143
143
|
<CenterView style={styles.pagePadding}>
|
|
144
144
|
{user?.photo && (
|
|
145
145
|
<View style={styles.photo}>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import OText from './OText';
|
|
3
|
+
|
|
4
|
+
const HeaderTitle = (props: any) => {
|
|
5
|
+
const { text, style } = props
|
|
6
|
+
return (
|
|
7
|
+
<OText
|
|
8
|
+
size={24}
|
|
9
|
+
style={style ?? {
|
|
10
|
+
marginTop: 30,
|
|
11
|
+
paddingHorizontal: 40,
|
|
12
|
+
textTransform: 'capitalize'
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
{text}
|
|
16
|
+
</OText>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default HeaderTitle
|
|
@@ -11,6 +11,7 @@ import OKeyButton from './OKeyButton'
|
|
|
11
11
|
import OModal from './OModal'
|
|
12
12
|
import OAlert from './OAlert'
|
|
13
13
|
import OBottomPopup from './OBottomPopup'
|
|
14
|
+
import HeaderTitle from './HeaderTitle'
|
|
14
15
|
|
|
15
16
|
export {
|
|
16
17
|
OText,
|
|
@@ -26,4 +27,5 @@ export {
|
|
|
26
27
|
OAlert,
|
|
27
28
|
OModal,
|
|
28
29
|
OBottomPopup,
|
|
30
|
+
HeaderTitle
|
|
29
31
|
}
|
|
@@ -170,6 +170,15 @@ export const getTypesText = (value: number) => {
|
|
|
170
170
|
return ret?.content;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* List shape for ribbon
|
|
175
|
+
*/
|
|
176
|
+
export const shape = {
|
|
177
|
+
rectangle: 'rectangle',
|
|
178
|
+
rectangleRound: 'rectangle_round',
|
|
179
|
+
capsuleShape: 'capsule_shape'
|
|
180
|
+
}
|
|
181
|
+
|
|
173
182
|
/**
|
|
174
183
|
* Function to transform degree to radian
|
|
175
184
|
* @param {number} value for transform
|