ordering-ui-react-native 0.22.0 → 0.22.1-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +4 -2
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/types/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +49 -27
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +36 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +40 -27
- package/themes/business/src/components/OrderDetails/Business.tsx +74 -9
- package/themes/business/src/components/OrderDetails/Delivery.tsx +138 -55
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +125 -43
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +62 -24
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +221 -0
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +210 -65
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +217 -156
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +39 -16
- package/themes/business/src/components/PreviousOrders/index.tsx +76 -66
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +41 -24
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +2 -2
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +15 -5
- package/themes/business/src/utils/index.tsx +25 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +11 -0
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
- package/themes/original/src/components/BusinessController/index.tsx +5 -5
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +44 -32
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
- package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +38 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -4
- package/themes/original/src/components/Checkout/index.tsx +110 -58
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +3 -11
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +2 -1
- package/themes/original/src/components/Messages/index.tsx +29 -17
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +79 -56
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
- package/themes/original/src/components/MyOrders/index.tsx +2 -2
- package/themes/original/src/components/NavBar/index.tsx +7 -4
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +13 -10
- package/themes/original/src/components/OrderDetails/index.tsx +44 -21
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +5 -4
- package/themes/original/src/components/OrderSummary/index.tsx +29 -10
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +3 -6
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +10 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +51 -44
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +86 -78
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
- package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +10 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +76 -62
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +159 -133
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/UserVerification/index.tsx +14 -4
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +30 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View, Dimensions } from 'react-native'
|
|
3
|
+
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'
|
|
4
|
+
import FeatherIcon from 'react-native-vector-icons/Feather'
|
|
5
|
+
import { useTheme } from 'styled-components/native'
|
|
6
|
+
import ToggleSwitch from 'toggle-switch-react-native';
|
|
7
|
+
import { useLanguage } from 'ordering-components/native'
|
|
8
|
+
|
|
9
|
+
import { _setStoreData, _retrieveStoreData } from '../../providers/StoreUtil'
|
|
10
|
+
import { Container, ContainerList, EnabledAutoPrint, NoPrintersContainer } from './styles'
|
|
11
|
+
import { OText, OIcon, OModal, OButton } from '../shared'
|
|
12
|
+
import { PrinterEdition } from '../PrinterEdition'
|
|
13
|
+
|
|
14
|
+
export const PrinterSettings = (props: any) => {
|
|
15
|
+
const { navigation, onClose } = props
|
|
16
|
+
|
|
17
|
+
const [printers, setPrinters] = useState<any>({ list: [] })
|
|
18
|
+
const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
|
|
19
|
+
const [openModal, setOpenModal] = useState<any>({ open: false, data: null })
|
|
20
|
+
|
|
21
|
+
const WIDTH_SCREEN = Dimensions.get('window').width
|
|
22
|
+
const HEIGHT_SCREEN = Dimensions.get('window').height
|
|
23
|
+
|
|
24
|
+
const [, t] = useLanguage()
|
|
25
|
+
const theme = useTheme()
|
|
26
|
+
|
|
27
|
+
const styles = StyleSheet.create({
|
|
28
|
+
icons: {
|
|
29
|
+
maxWidth: 40,
|
|
30
|
+
height: 40,
|
|
31
|
+
padding: 10,
|
|
32
|
+
alignItems: 'flex-end'
|
|
33
|
+
},
|
|
34
|
+
optionIcons: {
|
|
35
|
+
padding: 8,
|
|
36
|
+
borderWidth: 1,
|
|
37
|
+
marginRight: 10,
|
|
38
|
+
borderRadius: 8,
|
|
39
|
+
},
|
|
40
|
+
wIconContainer: {
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
width: WIDTH_SCREEN - 40 - 22 - 22 - 10, // screen - margin - icon - icon - marginIcon
|
|
44
|
+
},
|
|
45
|
+
wrapperContainer: {
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
},
|
|
48
|
+
wrapperIcons: {
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
justifyContent: 'flex-start',
|
|
51
|
+
marginBottom: 5,
|
|
52
|
+
},
|
|
53
|
+
inputStyle: {
|
|
54
|
+
height: 40,
|
|
55
|
+
borderWidth: 1,
|
|
56
|
+
borderRadius: 8,
|
|
57
|
+
},
|
|
58
|
+
btnBackArrow: {
|
|
59
|
+
borderWidth: 0,
|
|
60
|
+
width: 32,
|
|
61
|
+
height: 32,
|
|
62
|
+
tintColor: theme.colors.textGray,
|
|
63
|
+
backgroundColor: theme.colors.clear,
|
|
64
|
+
borderColor: theme.colors.clear,
|
|
65
|
+
shadowColor: theme.colors.clear,
|
|
66
|
+
paddingLeft: 0,
|
|
67
|
+
paddingRight: 0,
|
|
68
|
+
},
|
|
69
|
+
titleGroups: {
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
minHeight: 33,
|
|
73
|
+
},
|
|
74
|
+
addButtonText: {
|
|
75
|
+
color: theme.colors.inputTextColor,
|
|
76
|
+
fontSize: 16,
|
|
77
|
+
},
|
|
78
|
+
addButton: {
|
|
79
|
+
height: 40,
|
|
80
|
+
marginTop: 10,
|
|
81
|
+
borderRadius: 8,
|
|
82
|
+
marginRight: 10,
|
|
83
|
+
marginBottom: 10,
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
88
|
+
|
|
89
|
+
const handleClick = async ({ item, type, ip, edit, isAdd, index }: any) => {
|
|
90
|
+
let _item = item
|
|
91
|
+
const action = edit || isAdd
|
|
92
|
+
let _printers = printers.list
|
|
93
|
+
const idx = index ?? _printers.findIndex((p: any) => p.model === _item.model)
|
|
94
|
+
|
|
95
|
+
if (idx !== -1 && !action) {
|
|
96
|
+
_printers.splice(idx, 1);
|
|
97
|
+
} else {
|
|
98
|
+
const _currentPrinter = _printers.find((p: any) => p.model === _item?.model)
|
|
99
|
+
_item = {
|
|
100
|
+
..._currentPrinter,
|
|
101
|
+
...item,
|
|
102
|
+
type: type ?? _currentPrinter?.type ?? 1,
|
|
103
|
+
ip: ip ?? _currentPrinter?.ip ?? '',
|
|
104
|
+
portName: (type ?? _currentPrinter?.type) === 1 || !ip
|
|
105
|
+
? item?.bt ?? item.portName1 ?? _currentPrinter?.portName1
|
|
106
|
+
: `TCP:${ip}`
|
|
107
|
+
}
|
|
108
|
+
edit ? (_printers[idx] = _item) : _printers.push(_item)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
setPrinters({ list: _printers })
|
|
112
|
+
await _setStoreData('printers', _printers)
|
|
113
|
+
type === 1 && onClose && onClose()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const handleAutoPrint = async () => {
|
|
117
|
+
setAutoPrintEnabled(!autoPrintEnabled)
|
|
118
|
+
await _setStoreData('auto_print_after_accept_order', !autoPrintEnabled)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
const getStorageData = async () => {
|
|
123
|
+
const printers = await _retrieveStoreData('printers')
|
|
124
|
+
const autoPrint = await _retrieveStoreData('auto_print_after_accept_order')
|
|
125
|
+
setPrinters({ list: printers ?? [] })
|
|
126
|
+
setAutoPrintEnabled(!!autoPrint)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
getStorageData()
|
|
130
|
+
}, [])
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<Container>
|
|
134
|
+
<View style={styles.titleGroups}>
|
|
135
|
+
<TouchableOpacity onPress={() => goToBack()} style={styles.btnBackArrow}>
|
|
136
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
|
|
137
|
+
</TouchableOpacity>
|
|
138
|
+
</View>
|
|
139
|
+
<OText size={24} style={{ paddingTop: 0 }}>
|
|
140
|
+
{t('PRINTER_SETTINGS', 'Printer Settings')}
|
|
141
|
+
</OText>
|
|
142
|
+
{!!printers.list.length && (
|
|
143
|
+
<EnabledAutoPrint>
|
|
144
|
+
<View style={{ flex: 1 }}>
|
|
145
|
+
<OText
|
|
146
|
+
numberOfLines={2}
|
|
147
|
+
adjustsFontSizeToFit
|
|
148
|
+
color={theme.colors.textGray}
|
|
149
|
+
style={{ paddingHorizontal: 0 }}>
|
|
150
|
+
{t('AUTO_PRINT_AFTER_ACCEPTING_ORDER', 'Auto print after accepting order')}
|
|
151
|
+
</OText>
|
|
152
|
+
</View>
|
|
153
|
+
<ToggleSwitch
|
|
154
|
+
isOn={autoPrintEnabled}
|
|
155
|
+
onColor={theme.colors.primary}
|
|
156
|
+
offColor={theme.colors.offColor}
|
|
157
|
+
size="small"
|
|
158
|
+
onToggle={() => handleAutoPrint()}
|
|
159
|
+
animationSpeed={200}
|
|
160
|
+
/>
|
|
161
|
+
</EnabledAutoPrint>
|
|
162
|
+
)}
|
|
163
|
+
{!!printers.list.length && (
|
|
164
|
+
<OButton
|
|
165
|
+
text={t('ADD_PRINTER', 'Add printer')}
|
|
166
|
+
imgRightSrc={null}
|
|
167
|
+
textStyle={styles.addButtonText}
|
|
168
|
+
style={styles.addButton}
|
|
169
|
+
bgColor={theme.colors.primary}
|
|
170
|
+
borderColor={theme.colors.primary}
|
|
171
|
+
onClick={() => setOpenModal({ open: true, data: null })}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
174
|
+
<View>
|
|
175
|
+
{printers.list.map((item: any, i: number) => (
|
|
176
|
+
<ContainerList
|
|
177
|
+
key={i}
|
|
178
|
+
activeOpacity={1}
|
|
179
|
+
>
|
|
180
|
+
<View style={styles.wrapperContainer}>
|
|
181
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
182
|
+
<TouchableOpacity
|
|
183
|
+
activeOpacity={1}
|
|
184
|
+
style={styles.wIconContainer}
|
|
185
|
+
onPress={() => setOpenModal({ open: true, data: { ...item, index: i} })}
|
|
186
|
+
>
|
|
187
|
+
<SimpleLineIcons
|
|
188
|
+
name='printer'
|
|
189
|
+
color={theme.colors.textGray}
|
|
190
|
+
size={18}
|
|
191
|
+
style={{
|
|
192
|
+
...styles.icons,
|
|
193
|
+
color: theme.colors.primary
|
|
194
|
+
}}
|
|
195
|
+
/>
|
|
196
|
+
<OText
|
|
197
|
+
size={18}
|
|
198
|
+
color={theme.colors.primary}
|
|
199
|
+
>
|
|
200
|
+
{item?.nickname ?? item.model}
|
|
201
|
+
</OText>
|
|
202
|
+
</TouchableOpacity>
|
|
203
|
+
<TouchableOpacity
|
|
204
|
+
activeOpacity={1}
|
|
205
|
+
onPress={() => setOpenModal({ open: true, data: { ...item, index: i} })}
|
|
206
|
+
>
|
|
207
|
+
<FeatherIcon
|
|
208
|
+
name='edit'
|
|
209
|
+
size={22}
|
|
210
|
+
/>
|
|
211
|
+
</TouchableOpacity>
|
|
212
|
+
<TouchableOpacity
|
|
213
|
+
activeOpacity={1}
|
|
214
|
+
onPress={() => handleClick({ item })}
|
|
215
|
+
style={{ marginLeft: 10 }}
|
|
216
|
+
>
|
|
217
|
+
<FeatherIcon
|
|
218
|
+
name='trash-2'
|
|
219
|
+
size={22}
|
|
220
|
+
color={theme.colors.danger500}
|
|
221
|
+
/>
|
|
222
|
+
</TouchableOpacity>
|
|
223
|
+
</View>
|
|
224
|
+
</View>
|
|
225
|
+
</ContainerList>
|
|
226
|
+
))}
|
|
227
|
+
{!printers.list.length && (
|
|
228
|
+
<NoPrintersContainer style={{ height: HEIGHT_SCREEN/2 }}>
|
|
229
|
+
<OText
|
|
230
|
+
size={20}
|
|
231
|
+
color={theme.colors.textGray}
|
|
232
|
+
numberOfLines={2}
|
|
233
|
+
adjustsFontSizeToFit
|
|
234
|
+
style={{ paddingHorizontal: 0, opacity: 0.4 }}
|
|
235
|
+
>
|
|
236
|
+
{t('NO_PRINTERS_CONFIGURED', 'No printers configured')}
|
|
237
|
+
</OText>
|
|
238
|
+
<OButton
|
|
239
|
+
text={t('ADD_PRINTER', 'Add printer')}
|
|
240
|
+
imgRightSrc={null}
|
|
241
|
+
textStyle={styles.addButtonText}
|
|
242
|
+
style={styles.addButton}
|
|
243
|
+
bgColor={theme.colors.primary}
|
|
244
|
+
borderColor={theme.colors.primary}
|
|
245
|
+
onClick={() => setOpenModal({ open: true, data: null })}
|
|
246
|
+
/>
|
|
247
|
+
</NoPrintersContainer>
|
|
248
|
+
)}
|
|
249
|
+
</View>
|
|
250
|
+
<OModal
|
|
251
|
+
hideIcons
|
|
252
|
+
entireModal
|
|
253
|
+
customClose
|
|
254
|
+
open={openModal.open}
|
|
255
|
+
style={{ paddingTop: 0, marginTop: 0 }}
|
|
256
|
+
onClose={() => setOpenModal({ open: false, data: null })}
|
|
257
|
+
>
|
|
258
|
+
<PrinterEdition
|
|
259
|
+
printer={openModal.data}
|
|
260
|
+
printersList={printers}
|
|
261
|
+
handleChangePrinter={handleClick}
|
|
262
|
+
onClose={() => setOpenModal({ open: false, data: null })}
|
|
263
|
+
/>
|
|
264
|
+
</OModal>
|
|
265
|
+
</Container>
|
|
266
|
+
)
|
|
267
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
|
+
|
|
3
|
+
export const Container = styled.View`
|
|
4
|
+
margin-bottom: 50px;
|
|
5
|
+
`
|
|
6
|
+
|
|
7
|
+
export const ContainerList = styled.View`
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
width: 100%;
|
|
11
|
+
padding: 5px 5px 5px 0;
|
|
12
|
+
border-bottom-width: 1px;
|
|
13
|
+
border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export const EnabledAutoPrint = styled.View`
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: 20px 0px 10px;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const NoPrintersContainer = styled.View`
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
margin-top: 40px;
|
|
28
|
+
height: 100%;
|
|
29
|
+
flex: 1;
|
|
30
|
+
`
|
|
@@ -149,10 +149,10 @@ const StoresListUI = (props: BusinessesListingParams) => {
|
|
|
149
149
|
width={12}
|
|
150
150
|
height={12}
|
|
151
151
|
color={theme.colors.skyBlue}
|
|
152
|
-
style={{ marginRight: 5
|
|
152
|
+
style={{ marginRight: 5 }}
|
|
153
153
|
/>
|
|
154
154
|
<OText size={12}>
|
|
155
|
-
{t('MORE_SETTINGS_GO_TO', 'For more settings go to')}
|
|
155
|
+
{t('MORE_SETTINGS_GO_TO', 'For more settings go to ')}
|
|
156
156
|
</OText>
|
|
157
157
|
<TouchableOpacity onPress={() => { Linking.openURL(t('LINK_MORE_SETTINGS_GO_TO', 'https://app.ordering.co')) }}>
|
|
158
158
|
<OText size={12} color={theme.colors.skyBlue}>
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
useToast,
|
|
12
12
|
useLanguage,
|
|
13
13
|
useUtils,
|
|
14
|
-
useConfig
|
|
14
|
+
useConfig,
|
|
15
|
+
useValidationFields
|
|
15
16
|
} from 'ordering-components/native';
|
|
16
17
|
import {
|
|
17
18
|
CenterView,
|
|
@@ -24,6 +25,7 @@ import { LogoutButton } from '../LogoutButton';
|
|
|
24
25
|
import { LanguageSelector } from '../LanguageSelector';
|
|
25
26
|
import { UserFormDetailsUI } from '../UserFormDetails';
|
|
26
27
|
import { DriverSchedule } from '../DriverSchedule'
|
|
28
|
+
import { PrinterSettings } from '../PrinterSettings'
|
|
27
29
|
import ToggleSwitch from 'toggle-switch-react-native';
|
|
28
30
|
import { UDWrapper } from '../UserFormDetails/styles';
|
|
29
31
|
import {
|
|
@@ -56,11 +58,12 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
56
58
|
const [, t] = useLanguage();
|
|
57
59
|
const [, { showToast }] = useToast();
|
|
58
60
|
const [{ optimizeImage }] = useUtils();
|
|
59
|
-
const [{ configs }] = useConfig()
|
|
61
|
+
const [{ configs }] = useConfig();
|
|
62
|
+
const [{ loading }, { loadOriginalValidationFields }] = useValidationFields()
|
|
60
63
|
const { errors } = useForm();
|
|
61
64
|
const theme = useTheme();
|
|
62
65
|
|
|
63
|
-
const [phoneInputData, setPhoneInputData] = useState({
|
|
66
|
+
const [phoneInputData, setPhoneInputData] = useState<any>({
|
|
64
67
|
error: '',
|
|
65
68
|
phone: {
|
|
66
69
|
country_phone_code: null,
|
|
@@ -75,11 +78,8 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
75
78
|
const allowDriverUpdateData = user?.level !== 4 || configs?.allow_driver_update_data?.value === "1"
|
|
76
79
|
useEffect(() => {
|
|
77
80
|
if (phoneInputData.phone.cellphone) {
|
|
78
|
-
const codeNumberPhone = phoneInputData.phone.
|
|
79
|
-
const numberPhone = phoneInputData.phone.cellphone
|
|
80
|
-
3,
|
|
81
|
-
phoneInputData.phone.cellphone?.length,
|
|
82
|
-
);
|
|
81
|
+
const codeNumberPhone = phoneInputData.phone.country_phone_code
|
|
82
|
+
const numberPhone = phoneInputData.phone.cellphone
|
|
83
83
|
setPhoneToShow(`(${codeNumberPhone}) ${numberPhone}`);
|
|
84
84
|
}
|
|
85
85
|
}, [phoneInputData.phone.cellphone]);
|
|
@@ -261,15 +261,17 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
261
261
|
|
|
262
262
|
return (
|
|
263
263
|
<>
|
|
264
|
-
{validationFields?.error && (
|
|
264
|
+
{validationFields?.error && !loading && (
|
|
265
265
|
<NotFoundSource
|
|
266
266
|
content={
|
|
267
|
-
validationFields?.error[0] ||
|
|
268
|
-
validationFields?.error[0]?.message ||
|
|
267
|
+
validationFields?.error?.[0] ||
|
|
268
|
+
validationFields?.error?.[0]?.message ||
|
|
269
269
|
t('NETWORK_ERROR', 'Network Error')
|
|
270
270
|
}
|
|
271
271
|
image={theme.images.general.notFound}
|
|
272
272
|
conditioned={false}
|
|
273
|
+
onClickButton={() => loadOriginalValidationFields({ forceLoading: true })}
|
|
274
|
+
btnTitle={t('REFRESH_PROFILE', 'Refresh profile')}
|
|
273
275
|
/>
|
|
274
276
|
)}
|
|
275
277
|
|
|
@@ -462,7 +464,6 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
462
464
|
/>
|
|
463
465
|
|
|
464
466
|
<OText style={styles.label}>{t('PHONE', 'Phone')}</OText>
|
|
465
|
-
|
|
466
467
|
<OInput
|
|
467
468
|
isSecured={true}
|
|
468
469
|
placeholder={
|
|
@@ -503,17 +504,31 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
503
504
|
/>
|
|
504
505
|
</EditButton>
|
|
505
506
|
)}
|
|
506
|
-
|
|
507
|
-
<
|
|
508
|
-
<
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
507
|
+
{!props.isBusinessApp ? (
|
|
508
|
+
<Pressable style={{ marginBottom: 10 }} onPress={() => setOpenModal(true)}>
|
|
509
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
510
|
+
<OText size={16}>{t('SCHEDULE', 'Schedule')}</OText>
|
|
511
|
+
<AntDesignIcon size={18} name='right' />
|
|
512
|
+
</View>
|
|
513
|
+
<View style={{
|
|
514
|
+
borderBottomColor: theme.colors.tabBar,
|
|
515
|
+
borderBottomWidth: 1,
|
|
516
|
+
marginTop: 10
|
|
517
|
+
}} />
|
|
518
|
+
</Pressable>
|
|
519
|
+
) : (
|
|
520
|
+
<Pressable style={{ marginBottom: 10 }} onPress={() => navigation.navigate('PrinterSetup')}>
|
|
521
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
522
|
+
<OText size={16}>{t('PRINTER_SETTINGS', 'Printer Settings')}</OText>
|
|
523
|
+
<AntDesignIcon size={18} name='right' />
|
|
524
|
+
</View>
|
|
525
|
+
<View style={{
|
|
526
|
+
borderBottomColor: theme.colors.tabBar,
|
|
527
|
+
borderBottomWidth: 1,
|
|
528
|
+
marginTop: 10
|
|
529
|
+
}} />
|
|
530
|
+
</Pressable>
|
|
531
|
+
)}
|
|
517
532
|
<Pressable style={{ marginBottom: 10 }} onPress={() => navigation.navigate('Sessions')}>
|
|
518
533
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
519
534
|
<OText size={16}>{t('SESSIONS', 'Sessions')}</OText>
|
|
@@ -536,7 +551,9 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
536
551
|
entireModal
|
|
537
552
|
hideIcons
|
|
538
553
|
>
|
|
539
|
-
|
|
554
|
+
{!props.isBusinessApp && (
|
|
555
|
+
<DriverSchedule schedule={user?.schedule} />
|
|
556
|
+
)}
|
|
540
557
|
</OModal>
|
|
541
558
|
</ScrollView>
|
|
542
559
|
)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { useLanguage, useUtils, WebsocketStatus as WebsocketStatusController } from 'ordering-components/native'
|
|
3
|
-
import { TouchableOpacity, View, StyleSheet } from 'react-native'
|
|
3
|
+
import { TouchableOpacity, View, StyleSheet, Platform } from 'react-native'
|
|
4
4
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
5
5
|
import { useTheme } from 'styled-components/native'
|
|
6
6
|
import RNRestart from 'react-native-restart'
|
|
@@ -37,7 +37,7 @@ const SocketStatusUI = (props: any) => {
|
|
|
37
37
|
paddingLeft: 0,
|
|
38
38
|
paddingRight: 0,
|
|
39
39
|
marginBottom: 30,
|
|
40
|
-
marginTop: 30
|
|
40
|
+
marginTop: Platform.OS === 'ios' ? 60 : 30
|
|
41
41
|
},
|
|
42
42
|
})
|
|
43
43
|
|
|
@@ -4,8 +4,10 @@ import { useTheme } from 'styled-components/native';
|
|
|
4
4
|
|
|
5
5
|
const Wrapper = styled.View`
|
|
6
6
|
border-radius: 10px;
|
|
7
|
-
border: 1px
|
|
7
|
+
border-width: 1px;
|
|
8
|
+
border-color: ${(props: any) => props.theme.colors.lightGray};
|
|
8
9
|
`;
|
|
10
|
+
|
|
9
11
|
const Inner = styled.TextInput`
|
|
10
12
|
height: 100px;
|
|
11
13
|
padding: 5px 10px 5px 10px;
|
|
@@ -29,16 +31,13 @@ const OTextarea = (props: Props) => {
|
|
|
29
31
|
ref={props.textTareaRef}
|
|
30
32
|
onFocus={() => props.onFocus()}
|
|
31
33
|
onChangeText={(txt: any) => props.onChange(txt)}
|
|
32
|
-
textAlignVertical={'top'}
|
|
33
34
|
placeholder={props.placeholder}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
placeholderTextColor={theme.colors.lightGray}
|
|
36
|
+
numberOfLines={props.lines}
|
|
37
|
+
underlineColorAndroid={'transparent'}
|
|
38
|
+
value={props.value}
|
|
39
|
+
multiline={true}
|
|
38
40
|
autoFocus={props.autoFocus}
|
|
39
|
-
multiline={true}
|
|
40
|
-
selectionColor={theme.colors.primary}
|
|
41
|
-
color={theme.colors.textGray}
|
|
42
41
|
/>
|
|
43
42
|
</Wrapper>
|
|
44
43
|
);
|
|
@@ -48,8 +48,8 @@ export const useLocation = () => {
|
|
|
48
48
|
GeoLocation.getCurrentPosition(
|
|
49
49
|
({ coords }) => {
|
|
50
50
|
resolve({
|
|
51
|
-
latitude: typeof coords.latitude
|
|
52
|
-
longitude: typeof coords.longitude
|
|
51
|
+
latitude: typeof coords.latitude === 'number' && !Number.isNaN(coords.latitude) ? coords.latitude : 0,
|
|
52
|
+
longitude: typeof coords.longitude === 'number' && !Number.isNaN(coords.longitude) ? coords.longitude : 0,
|
|
53
53
|
speed: coords.speed,
|
|
54
54
|
});
|
|
55
55
|
},
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Dimensions,
|
|
4
4
|
Platform,
|
|
5
5
|
StatusBar,
|
|
6
|
-
StyleSheet,
|
|
7
6
|
View,
|
|
8
7
|
} from 'react-native';
|
|
9
|
-
import styled from 'styled-components/native';
|
|
8
|
+
import styled, { useTheme } from 'styled-components/native';
|
|
9
|
+
import { useNetInfo } from '@react-native-community/netinfo';
|
|
10
10
|
|
|
11
11
|
export const SafeAreaContainer = styled.SafeAreaView`
|
|
12
12
|
flex: 1;
|
|
@@ -14,6 +14,10 @@ export const SafeAreaContainer = styled.SafeAreaView`
|
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
16
|
export const SafeAreaContainerLayout = (props: any) => {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const netInfo = useNetInfo()
|
|
19
|
+
|
|
20
|
+
const [statusColor, setStatusColor] = useState<string | null>(null)
|
|
17
21
|
const [orientation, setOrientation] = useState(
|
|
18
22
|
Dimensions.get('window').width < Dimensions.get('window').height
|
|
19
23
|
? 'Portrait'
|
|
@@ -28,22 +32,34 @@ export const SafeAreaContainerLayout = (props: any) => {
|
|
|
28
32
|
}
|
|
29
33
|
});
|
|
30
34
|
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (netInfo.isConnected === false) {
|
|
37
|
+
setStatusColor(theme.colors.danger500)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (netInfo.isConnected && statusColor) {
|
|
41
|
+
setStatusColor(theme.colors.success500)
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
setStatusColor(null)
|
|
44
|
+
}, 2000);
|
|
45
|
+
}
|
|
46
|
+
}, [netInfo.isConnected])
|
|
47
|
+
|
|
31
48
|
return (
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
</>
|
|
49
|
+
<SafeAreaContainer>
|
|
50
|
+
<View
|
|
51
|
+
style={{
|
|
52
|
+
paddingHorizontal: 30,
|
|
53
|
+
paddingTop: 0,
|
|
54
|
+
paddingBottom: 0,
|
|
55
|
+
flex: 1,
|
|
56
|
+
}}>
|
|
57
|
+
<StatusBar
|
|
58
|
+
barStyle={Platform.OS === 'ios' ? 'dark-content' : 'default'}
|
|
59
|
+
{...statusColor && ({ backgroundColor: statusColor })}
|
|
60
|
+
/>
|
|
61
|
+
{props.children}
|
|
62
|
+
</View>
|
|
63
|
+
</SafeAreaContainer>
|
|
48
64
|
);
|
|
49
65
|
};
|
|
@@ -59,6 +59,7 @@ export interface ProfileParams {
|
|
|
59
59
|
isAlsea?: boolean;
|
|
60
60
|
isShowDriverStatus?: boolean;
|
|
61
61
|
isFocused?: boolean;
|
|
62
|
+
isBusinessApp?: boolean;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
export interface AddressListParams {
|
|
@@ -310,9 +311,9 @@ export interface OrdersOptionParams {
|
|
|
310
311
|
cancelled?: Array<number>;
|
|
311
312
|
};
|
|
312
313
|
isBusinessApp?: boolean;
|
|
313
|
-
handleClickLogisticOrder
|
|
314
|
-
logisticOrders
|
|
315
|
-
loadLogisticOrders
|
|
314
|
+
handleClickLogisticOrder?: (status: number, orderId: number) => void,
|
|
315
|
+
logisticOrders?: { orders: Array<any>, loading: boolean, error: Array<string> | string },
|
|
316
|
+
loadLogisticOrders?: () => void;
|
|
316
317
|
isLogisticActivated?: boolean;
|
|
317
318
|
isAlsea?: boolean;
|
|
318
319
|
checkNotification?: boolean;
|
|
@@ -320,6 +321,10 @@ export interface OrdersOptionParams {
|
|
|
320
321
|
handleChangeOrderStatus?: () => void;
|
|
321
322
|
handleSendCustomerReview?: () => void;
|
|
322
323
|
orderDetailsProps?: any;
|
|
324
|
+
isNetConnected?: boolean;
|
|
325
|
+
isDriverApp?: boolean;
|
|
326
|
+
combineTabs?: boolean;
|
|
327
|
+
setCombineTabsState?: any;
|
|
323
328
|
}
|
|
324
329
|
export interface ActiveOrdersParams {
|
|
325
330
|
orders?: any;
|
|
@@ -391,7 +396,7 @@ export interface OrderDetailsParams {
|
|
|
391
396
|
urlToShare?: string;
|
|
392
397
|
messages?: any;
|
|
393
398
|
handleAssignDriver?: (id: any) => {};
|
|
394
|
-
handleChangeOrderStatus?: (status: any) => {};
|
|
399
|
+
handleChangeOrderStatus?: (status: any, isAcceptOrReject: any) => {};
|
|
395
400
|
order?: any;
|
|
396
401
|
isFromRoot?: any;
|
|
397
402
|
handleOrderRedirect?: () => {};
|
|
@@ -410,6 +415,8 @@ export interface OrderDetailsParams {
|
|
|
410
415
|
orderTitle?: any;
|
|
411
416
|
forceUpdate?: number;
|
|
412
417
|
getPermissions?: any
|
|
418
|
+
loadMessages?: any;
|
|
419
|
+
notificationApp?: string
|
|
413
420
|
}
|
|
414
421
|
export interface ProductItemAccordionParams {
|
|
415
422
|
isCartPending?: boolean;
|
|
@@ -445,6 +452,7 @@ export interface MessagesParams {
|
|
|
445
452
|
sendMessage?: any;
|
|
446
453
|
canRead?: any;
|
|
447
454
|
setCanRead?: any;
|
|
455
|
+
notificationApp?: string
|
|
448
456
|
handleSend?: () => {};
|
|
449
457
|
setImage?: (image: string | null) => {};
|
|
450
458
|
setMessage?: (comment: string) => {};
|
|
@@ -495,7 +503,8 @@ export interface FloatingButtonParams {
|
|
|
495
503
|
firstColorCustom?: string;
|
|
496
504
|
secondColorCustom?: string;
|
|
497
505
|
paddingBottomIos?: any;
|
|
498
|
-
isHideRejectButtons?: boolean
|
|
506
|
+
isHideRejectButtons?: boolean;
|
|
507
|
+
principalButtonColor?: string;
|
|
499
508
|
}
|
|
500
509
|
export interface MomentOptionParams {
|
|
501
510
|
navigation: any;
|
|
@@ -596,6 +605,7 @@ export interface AcceptOrRejectOrderParams {
|
|
|
596
605
|
isPage?: boolean
|
|
597
606
|
navigation?: any
|
|
598
607
|
route?: any
|
|
608
|
+
isLoadingOrder?: boolean
|
|
599
609
|
}
|
|
600
610
|
|
|
601
611
|
export interface MapViewParams {
|