ordering-ui-react-native 0.22.99 → 0.23.1
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/DriverMap/index.tsx +29 -25
- package/themes/business/src/components/OrderDetails/Business.tsx +3 -1
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +138 -74
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/types/index.tsx +3 -1
- package/themes/original/src/components/Checkout/index.tsx +6 -2
package/package.json
CHANGED
|
@@ -69,15 +69,12 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
69
69
|
stopFollowUserLocation,
|
|
70
70
|
} = useLocation();
|
|
71
71
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
latitude: typeof initialPosition.latitude === 'string' ? parseFloat(initialPosition.latitude) || 0 : initialPosition.latitude || 0,
|
|
79
|
-
longitude: typeof initialPosition.longitude === 'string' ? parseFloat(initialPosition.longitude) || 0 : initialPosition.longitude || 0,
|
|
80
|
-
}
|
|
72
|
+
const parsedInitialPosition = useCallback(() => {
|
|
73
|
+
return {
|
|
74
|
+
latitude: typeof initialPosition.latitude === 'string' ? parseFloat(initialPosition.latitude) || 0 : initialPosition.latitude || 0,
|
|
75
|
+
longitude: typeof initialPosition.longitude === 'string' ? parseFloat(initialPosition.longitude) || 0 : initialPosition.longitude || 0,
|
|
76
|
+
}
|
|
77
|
+
}, [JSON.stringify(initialPosition)])
|
|
81
78
|
|
|
82
79
|
const parsedUserLocation = useCallback(() => {
|
|
83
80
|
return {
|
|
@@ -86,6 +83,13 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
86
83
|
}
|
|
87
84
|
}, [JSON.stringify(userLocation)])
|
|
88
85
|
|
|
86
|
+
const parsedDestination = useCallback(() => {
|
|
87
|
+
return {
|
|
88
|
+
latitude: typeof location?.lat === 'string' ? parseFloat(location?.lat) || 0 : location?.lat || 0,
|
|
89
|
+
longitude: typeof location?.lng === 'string' ? parseFloat(location?.lng) || 0 : location?.lng || 0
|
|
90
|
+
}
|
|
91
|
+
}, [JSON.stringify(location)])
|
|
92
|
+
|
|
89
93
|
useEffect(() => {
|
|
90
94
|
if (isToFollow) {
|
|
91
95
|
fitCoordinates();
|
|
@@ -172,8 +176,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
172
176
|
if (driverUpdateLocation.error) return;
|
|
173
177
|
|
|
174
178
|
calculateDistance(
|
|
175
|
-
{ lat: parsedUserLocation()
|
|
176
|
-
|
|
179
|
+
{ lat: parsedUserLocation()?.latitude, lng: parsedUserLocation()?.longitude },
|
|
180
|
+
parsedDestination(),
|
|
177
181
|
);
|
|
178
182
|
// geocodePosition(userLocation);
|
|
179
183
|
|
|
@@ -252,8 +256,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
252
256
|
[
|
|
253
257
|
{ latitude: location.lat, longitude: location.lng },
|
|
254
258
|
{
|
|
255
|
-
latitude: parsedInitialPosition
|
|
256
|
-
longitude: parsedInitialPosition
|
|
259
|
+
latitude: parsedInitialPosition()?.latitude,
|
|
260
|
+
longitude: parsedInitialPosition()?.longitude,
|
|
257
261
|
},
|
|
258
262
|
],
|
|
259
263
|
{
|
|
@@ -266,7 +270,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
266
270
|
|
|
267
271
|
useEffect(() => {
|
|
268
272
|
const interval = setInterval(() => {
|
|
269
|
-
if (parsedInitialPosition
|
|
273
|
+
if (parsedInitialPosition()?.latitude !== 0 && autoFit.current) {
|
|
270
274
|
if (mapRef.current) {
|
|
271
275
|
fitCoordinates();
|
|
272
276
|
autoFit.current = false;
|
|
@@ -274,7 +278,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
274
278
|
}
|
|
275
279
|
}, 1000);
|
|
276
280
|
return () => clearInterval(interval);
|
|
277
|
-
}, [parsedInitialPosition]);
|
|
281
|
+
}, [parsedInitialPosition()]);
|
|
278
282
|
|
|
279
283
|
const fitCoordinatesZoom = () => {
|
|
280
284
|
following.current = false;
|
|
@@ -357,8 +361,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
357
361
|
ref={mapRef}
|
|
358
362
|
provider={PROVIDER_GOOGLE}
|
|
359
363
|
initialRegion={{
|
|
360
|
-
latitude: parsedInitialPosition
|
|
361
|
-
longitude: parsedInitialPosition
|
|
364
|
+
latitude: parsedInitialPosition()?.latitude,
|
|
365
|
+
longitude: parsedInitialPosition()?.longitude,
|
|
362
366
|
latitudeDelta: 0.001,
|
|
363
367
|
longitudeDelta: 0.001 * ASPECT_RATIO,
|
|
364
368
|
}}
|
|
@@ -380,8 +384,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
380
384
|
<>
|
|
381
385
|
<Marker
|
|
382
386
|
coordinate={{
|
|
383
|
-
latitude:
|
|
384
|
-
longitude:
|
|
387
|
+
latitude: parsedDestination()?.latitude,
|
|
388
|
+
longitude: parsedDestination()?.longitude
|
|
385
389
|
}}
|
|
386
390
|
title={location.title}>
|
|
387
391
|
<Icon
|
|
@@ -415,8 +419,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
415
419
|
) : (
|
|
416
420
|
<Marker
|
|
417
421
|
coordinate={{
|
|
418
|
-
latitude:
|
|
419
|
-
longitude:
|
|
422
|
+
latitude: parsedUserLocation()?.latitude,
|
|
423
|
+
longitude: parsedUserLocation()?.longitude
|
|
420
424
|
}}
|
|
421
425
|
title={markerTitle || t('YOUR_LOCATION', 'Your Location')}
|
|
422
426
|
/>
|
|
@@ -528,10 +532,10 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
528
532
|
animationIn: 'slideInUp'
|
|
529
533
|
}}
|
|
530
534
|
options={{
|
|
531
|
-
latitude:
|
|
532
|
-
longitude:
|
|
533
|
-
sourceLatitude: parsedUserLocation()
|
|
534
|
-
sourceLongitude: parsedUserLocation()
|
|
535
|
+
latitude: parsedDestination()?.latitude,
|
|
536
|
+
longitude: parsedDestination()?.longitude,
|
|
537
|
+
sourceLatitude: parsedUserLocation()?.latitude,
|
|
538
|
+
sourceLongitude: parsedUserLocation()?.longitude,
|
|
535
539
|
naverCallerName: 'com.deliveryapp',
|
|
536
540
|
dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
|
|
537
541
|
dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
|
|
@@ -53,7 +53,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
53
53
|
actions,
|
|
54
54
|
orderTitle,
|
|
55
55
|
appTitle,
|
|
56
|
-
loadMessages
|
|
56
|
+
loadMessages,
|
|
57
|
+
notificationApp
|
|
57
58
|
} = props;
|
|
58
59
|
|
|
59
60
|
const theme = useTheme();
|
|
@@ -594,6 +595,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
594
595
|
messages={messages}
|
|
595
596
|
order={order}
|
|
596
597
|
setMessages={setMessages}
|
|
598
|
+
notificationApp={notificationApp}
|
|
597
599
|
/>
|
|
598
600
|
</OModal>
|
|
599
601
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components/native'
|
|
3
|
+
import { OText } from '../shared'
|
|
4
|
+
|
|
5
|
+
export const MessageAlert = ({ message, resetMsg }: any) => {
|
|
6
|
+
const theme = useTheme()
|
|
7
|
+
|
|
8
|
+
const [text, setText] = useState(message)
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setText(message)
|
|
12
|
+
}, [message])
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (text) {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
setText(null)
|
|
18
|
+
resetMsg()
|
|
19
|
+
}, 2000);
|
|
20
|
+
}
|
|
21
|
+
}, [text])
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
text ? (
|
|
25
|
+
<OText
|
|
26
|
+
size={14}
|
|
27
|
+
color={theme.colors.danger500}
|
|
28
|
+
>
|
|
29
|
+
{text}
|
|
30
|
+
</OText>
|
|
31
|
+
) : null
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { StarPRNT } from 'react-native-star-prnt';
|
|
3
|
+
import { ActivityIndicator, Dimensions, SafeAreaView, StyleSheet, View } from 'react-native';
|
|
3
4
|
import SelectDropdown from 'react-native-select-dropdown'
|
|
4
5
|
import { useLanguage } from 'ordering-components/native'
|
|
5
6
|
import { useTheme } from 'styled-components/native'
|
|
@@ -20,47 +21,36 @@ import {
|
|
|
20
21
|
import { Container } from '../../layouts/Container'
|
|
21
22
|
import { OText, OInput, OIcon, OButton } from '../shared'
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{ nickname: 'SM-S230i', model: 'SM-S230i', emulation: 'EscosMobile', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
|
|
35
|
-
{ nickname: 'SM-T300i/T300', model: 'SM-T300i/T300', emulation: 'EscPosMobile', portName1: 'BT:SMT300i/T300', type: 1, ip: '', printMode: 'append' },
|
|
36
|
-
{ nickname: 'SM-T400i', model: 'SM-T400i', emulation: 'EscosMobile', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
|
|
37
|
-
{ nickname: 'SM-L200', model: 'SM-L200', emulation: 'StarPRNT', portName1: 'BT:SML200', type: 1, ip: '', printMode: 'append' },
|
|
38
|
-
{ nickname: 'SM-L300', model: 'SM-L300', emulation: 'StarPRNT', portName1: 'BT:SML300', type: 1, ip: '', printMode: 'append' },
|
|
39
|
-
{ nickname: 'BSC10', model: 'BSC10', emulation: 'EscPos', portName1: 'BT:BSC10', type: 1, ip: '', printMode: 'append' },
|
|
40
|
-
{ nickname: 'SM-S210i StarPRNT', model: 'SM-S210i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS210i', type: 1, ip: '', printMode: 'append' },
|
|
41
|
-
{ nickname: 'SM-S220i StarPRNT', model: 'SM-S220i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS220i', type: 1, ip: '', printMode: 'append' },
|
|
42
|
-
{ nickname: 'SM-S230i StarPRNT', model: 'SM-S230i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
|
|
43
|
-
{ nickname: 'SM-T300i/T300 StarPRNT', model: 'SM-T300i/T300 StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT300i', type: 1, ip: '', printMode: 'append' },
|
|
44
|
-
{ nickname: 'SM-T400i StarPRNT', model: 'SM-T400i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
|
|
45
|
-
]
|
|
24
|
+
import { PRINTERS } from './printerList'
|
|
25
|
+
import { MessageAlert } from './MessageAlert'
|
|
26
|
+
|
|
27
|
+
const printerList = PRINTERS.map(printer => ({
|
|
28
|
+
...printer,
|
|
29
|
+
ip: '',
|
|
30
|
+
type: 1,
|
|
31
|
+
nickname: printer.model,
|
|
32
|
+
portName1: `BT:${printer.model.split(' ')[0]}`,
|
|
33
|
+
bt: `BT:${printer.model.split(' ')[0]}`
|
|
34
|
+
}))
|
|
46
35
|
|
|
47
36
|
export const PrinterEdition = (props: any) => {
|
|
48
|
-
const {
|
|
49
|
-
printer,
|
|
50
|
-
onClose
|
|
51
|
-
} = props
|
|
37
|
+
const { printer, onClose } = props
|
|
52
38
|
|
|
53
39
|
const HEIGHT_SCREEN = Dimensions.get('window').height
|
|
54
40
|
const [, t] = useLanguage()
|
|
55
41
|
const theme = useTheme()
|
|
56
|
-
const {
|
|
42
|
+
const { control, setValue, watch } = useForm()
|
|
43
|
+
|
|
44
|
+
const [currentPrinter, setCurrentPrinter] = useState(printer)
|
|
45
|
+
const [discoverPort, setDiscoverPort] = useState({ loading: false, msg: null })
|
|
57
46
|
|
|
58
47
|
const watchIp = watch('ip')
|
|
48
|
+
const watchBt = watch('bt')
|
|
59
49
|
const watchNickname = watch('nickname')
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const
|
|
50
|
+
const errorIP = !/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i.test(watchIp)
|
|
51
|
+
const errorBT = !/^[^\n]*$/i.test(watchBt) || !watchBt
|
|
52
|
+
const isErrorInput = currentPrinter?.type === 2 ? errorIP : errorBT
|
|
53
|
+
const isErrorNickname = watchNickname && !/^[^\n]*$/i.test(watchNickname)
|
|
64
54
|
|
|
65
55
|
const styles = StyleSheet.create({
|
|
66
56
|
icons: {
|
|
@@ -98,6 +88,36 @@ export const PrinterEdition = (props: any) => {
|
|
|
98
88
|
})
|
|
99
89
|
}
|
|
100
90
|
|
|
91
|
+
const portDiscovery = async () => {
|
|
92
|
+
try {
|
|
93
|
+
setDiscoverPort({ ...discoverPort, loading: true })
|
|
94
|
+
let printers = await StarPRNT.portDiscovery('Bluetooth');
|
|
95
|
+
|
|
96
|
+
if (printers?.length) {
|
|
97
|
+
setValue('bt', printers[0]?.portName)
|
|
98
|
+
setCurrentPrinter({
|
|
99
|
+
...currentPrinter,
|
|
100
|
+
['bt']: printers[0]?.portName
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
setDiscoverPort({
|
|
105
|
+
...discoverPort,
|
|
106
|
+
loading: false,
|
|
107
|
+
msg: !printers?.length
|
|
108
|
+
? t('NO_PRINTERS_FOUND', 'No printers found')
|
|
109
|
+
: null
|
|
110
|
+
})
|
|
111
|
+
}, 1000);
|
|
112
|
+
} catch (e) {
|
|
113
|
+
setValue('bt', currentPrinter?.portName)
|
|
114
|
+
setCurrentPrinter({
|
|
115
|
+
...currentPrinter,
|
|
116
|
+
['bt']: currentPrinter?.portName
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
101
121
|
const onSubmit = () => {
|
|
102
122
|
handleChangePrinter({ edit: !!printer, isAdd: !printer })
|
|
103
123
|
onClose && onClose()
|
|
@@ -105,6 +125,7 @@ export const PrinterEdition = (props: any) => {
|
|
|
105
125
|
|
|
106
126
|
useEffect(() => {
|
|
107
127
|
currentPrinter?.ip && setValue('ip', currentPrinter?.ip)
|
|
128
|
+
currentPrinter?.bt && setValue('bt', currentPrinter?.bt)
|
|
108
129
|
currentPrinter?.nickname && setValue('nickname', currentPrinter?.nickname)
|
|
109
130
|
}, [currentPrinter?.type])
|
|
110
131
|
|
|
@@ -281,51 +302,93 @@ export const PrinterEdition = (props: any) => {
|
|
|
281
302
|
{t('CONNECTION_VIA_LAN', 'Via LAN')}
|
|
282
303
|
</OText>
|
|
283
304
|
</WrapperIcon>
|
|
284
|
-
{
|
|
285
|
-
|
|
286
|
-
<View style={{ flexDirection: 'row' }}>
|
|
287
|
-
<Controller
|
|
288
|
-
control={control}
|
|
289
|
-
name={'ip'}
|
|
290
|
-
rules={{
|
|
291
|
-
required: t('VALIDATION_ERROR_IP_ADDRESS_REQUIRED', 'Ip address is required'),
|
|
292
|
-
pattern: {
|
|
293
|
-
value: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i,
|
|
294
|
-
message: t('INVALID_ERROR_IP_ADDRESS', 'Invalid ip address')
|
|
295
|
-
}
|
|
296
|
-
}}
|
|
297
|
-
defaultValue={currentPrinter?.ip ?? ''}
|
|
298
|
-
render={() => (
|
|
299
|
-
<OInput
|
|
300
|
-
placeholder={t('IP_ADDRESS', 'Ip address')}
|
|
301
|
-
placeholderTextColor={theme.colors.arrowColor}
|
|
302
|
-
style={{
|
|
303
|
-
...styles.inputStyle,
|
|
304
|
-
borderColor: isErrorIp ? theme.colors.danger500 : theme.colors.tabBar
|
|
305
|
-
}}
|
|
306
|
-
value={currentPrinter?.ip ?? ''}
|
|
307
|
-
selectionColor={theme.colors.primary}
|
|
308
|
-
color={theme.colors.textGray}
|
|
309
|
-
onChange={(value: any) => {
|
|
310
|
-
setValue('ip', value)
|
|
311
|
-
setCurrentPrinter({
|
|
312
|
-
...currentPrinter,
|
|
313
|
-
ip: value
|
|
314
|
-
})
|
|
315
|
-
}}
|
|
316
|
-
/>
|
|
317
|
-
)}
|
|
318
|
-
/>
|
|
319
|
-
</View>
|
|
305
|
+
<View style={{ flexDirection: 'column', marginTop: 30 }}>
|
|
306
|
+
{currentPrinter?.type === 1 && (
|
|
320
307
|
<OText
|
|
321
308
|
size={14}
|
|
322
|
-
color={theme.colors.
|
|
323
|
-
style={{
|
|
309
|
+
color={theme.colors.toastInfo}
|
|
310
|
+
style={{ marginBottom: 10 }}
|
|
324
311
|
>
|
|
325
|
-
{
|
|
312
|
+
{t('SEARCH_AVAILABLE_PRINTER_MESSAGE', 'Use the search icon to find an available printer')}
|
|
326
313
|
</OText>
|
|
327
|
-
|
|
328
|
-
|
|
314
|
+
)}
|
|
315
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
316
|
+
<Controller
|
|
317
|
+
control={control}
|
|
318
|
+
name={currentPrinter?.type === 2 ? 'ip' : 'bt'}
|
|
319
|
+
rules={{
|
|
320
|
+
required: currentPrinter?.type === 2
|
|
321
|
+
? t('VALIDATION_ERROR_IP_ADDRESS_REQUIRED', 'Ip address is required')
|
|
322
|
+
: t('VALIDATION_ERROR_BLUETOOTH_PORN_REQUIRED', 'Bluetooth port name is required'),
|
|
323
|
+
pattern: {
|
|
324
|
+
value: currentPrinter?.type === 2
|
|
325
|
+
? /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i
|
|
326
|
+
: /^[a-zA-Z0-9]+$/i,
|
|
327
|
+
message: currentPrinter?.type === 2
|
|
328
|
+
? t('INVALID_ERROR_IP_ADDRESS', 'Invalid ip address')
|
|
329
|
+
: t('INVALID_ERROR_BLUETOOTH_PORT_NAME', 'Invalid bluetooth port name')
|
|
330
|
+
}
|
|
331
|
+
}}
|
|
332
|
+
defaultValue={currentPrinter?.type === 2 ? currentPrinter?.ip ?? '' : currentPrinter?.bt ?? ''}
|
|
333
|
+
render={() => (
|
|
334
|
+
<OInput
|
|
335
|
+
placeholder={currentPrinter?.type === 2
|
|
336
|
+
? t('IP_ADDRESS', 'Ip address')
|
|
337
|
+
: t('BLUETOOTH_PORT', 'Bluetooth port')
|
|
338
|
+
}
|
|
339
|
+
placeholderTextColor={theme.colors.arrowColor}
|
|
340
|
+
style={{
|
|
341
|
+
...styles.inputStyle,
|
|
342
|
+
borderColor: isErrorInput ? theme.colors.danger500 : theme.colors.tabBar
|
|
343
|
+
}}
|
|
344
|
+
value={currentPrinter?.type === 2 ? currentPrinter?.ip ?? '' : currentPrinter?.bt ?? ''}
|
|
345
|
+
selectionColor={theme.colors.primary}
|
|
346
|
+
color={theme.colors.textGray}
|
|
347
|
+
onChange={(value: any) => {
|
|
348
|
+
setValue(currentPrinter?.type === 2 ? 'ip' : 'bt', value)
|
|
349
|
+
setCurrentPrinter({
|
|
350
|
+
...currentPrinter,
|
|
351
|
+
[currentPrinter?.type === 2 ? 'ip' : 'bt']: value
|
|
352
|
+
})
|
|
353
|
+
}}
|
|
354
|
+
/>
|
|
355
|
+
)}
|
|
356
|
+
/>
|
|
357
|
+
{currentPrinter?.type === 1 && (
|
|
358
|
+
<>
|
|
359
|
+
{!discoverPort.loading ? (
|
|
360
|
+
<FAIcons
|
|
361
|
+
name='search'
|
|
362
|
+
size={22}
|
|
363
|
+
color={theme.colors.primary}
|
|
364
|
+
style={{ marginLeft: 10 }}
|
|
365
|
+
onPress={() => portDiscovery()}
|
|
366
|
+
/>
|
|
367
|
+
) : (
|
|
368
|
+
<ActivityIndicator
|
|
369
|
+
size="small"
|
|
370
|
+
style={{ marginLeft: 10 }}
|
|
371
|
+
color={theme.colors.primary}
|
|
372
|
+
/>
|
|
373
|
+
)}
|
|
374
|
+
</>
|
|
375
|
+
)}
|
|
376
|
+
</View>
|
|
377
|
+
</View>
|
|
378
|
+
<OText
|
|
379
|
+
size={14}
|
|
380
|
+
color={theme.colors.tabBar}
|
|
381
|
+
style={{ paddingTop: 5, paddingLeft: 10 }}
|
|
382
|
+
>
|
|
383
|
+
{discoverPort.msg ? (
|
|
384
|
+
<MessageAlert
|
|
385
|
+
message={discoverPort.msg}
|
|
386
|
+
resetMsg={() => setDiscoverPort({ ...discoverPort, msg: null })}
|
|
387
|
+
/>
|
|
388
|
+
) : (
|
|
389
|
+
`${t('EXAMPLE_SHORT', 'Ex:')} ${currentPrinter?.type === 2 ? '8.8.8.8' : currentPrinter?.portName1}`
|
|
390
|
+
)}
|
|
391
|
+
</OText>
|
|
329
392
|
</WrapperIcons>
|
|
330
393
|
)}
|
|
331
394
|
</ContainerEdition>
|
|
@@ -341,6 +404,7 @@ export const PrinterEdition = (props: any) => {
|
|
|
341
404
|
isDisabled={
|
|
342
405
|
isErrorNickname ||
|
|
343
406
|
!currentPrinter?.model ||
|
|
407
|
+
currentPrinter?.type === 1 && !currentPrinter?.bt ||
|
|
344
408
|
currentPrinter?.type === 2 && !currentPrinter?.ip
|
|
345
409
|
}
|
|
346
410
|
onClick={() => onSubmit()}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const PRINTERS = [
|
|
2
|
+
{ model: 'mPOP', emulation: 'StarPRNT', printMode: 'append' },
|
|
3
|
+
{ model: 'FVP10', emulation: 'StarLine', printMode: 'append' },
|
|
4
|
+
{ model: 'TSP100', emulation: 'StarGraphic', printMode: 'appendBitmapText' },
|
|
5
|
+
{ model: 'TSP100IV', emulation: 'StarLine', printMode: 'append' },
|
|
6
|
+
{ model: 'TSP65011', emulation: 'StarLine', printMode: 'append' },
|
|
7
|
+
{ model: 'TSP7001', emulation: 'StarLine', printMode: 'append' },
|
|
8
|
+
{ model: 'TSP80011', emulation: 'StarLine', printMode: 'append' },
|
|
9
|
+
{ model: 'SP700', emulation: 'StarDotImpact', printMode: 'append' },
|
|
10
|
+
{ model: 'SM-S210i', emulation: 'EscPosMobile', printMode: 'append' },
|
|
11
|
+
{ model: 'SM-S220i', emulation: 'EscPosMobile', printMode: 'append' },
|
|
12
|
+
{ model: 'SM-S230i', emulation: 'EscosMobile', printMode: 'append' },
|
|
13
|
+
{ model: 'SM-T300i/T300', emulation: 'EscPosMobile', printMode: 'append' },
|
|
14
|
+
{ model: 'SM-T400i', emulation: 'EscosMobile', printMode: 'append' },
|
|
15
|
+
{ model: 'SM-L200', emulation: 'StarPRNT', printMode: 'append' },
|
|
16
|
+
{ model: 'SM-L300', emulation: 'StarPRNT', printMode: 'append' },
|
|
17
|
+
{ model: 'BSC10', emulation: 'EscPos', bt: 'BT:BSC10', printMode: 'append' },
|
|
18
|
+
{ model: 'SM-S210i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
19
|
+
{ model: 'SM-S220i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
20
|
+
{ model: 'SM-S230i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
21
|
+
{ model: 'SM-T300i/T300 StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
22
|
+
{ model: 'SM-T400i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
23
|
+
]
|
|
@@ -415,7 +415,8 @@ export interface OrderDetailsParams {
|
|
|
415
415
|
orderTitle?: any;
|
|
416
416
|
forceUpdate?: number;
|
|
417
417
|
getPermissions?: any
|
|
418
|
-
loadMessages?: any
|
|
418
|
+
loadMessages?: any;
|
|
419
|
+
notificationApp?: string
|
|
419
420
|
}
|
|
420
421
|
export interface ProductItemAccordionParams {
|
|
421
422
|
isCartPending?: boolean;
|
|
@@ -451,6 +452,7 @@ export interface MessagesParams {
|
|
|
451
452
|
sendMessage?: any;
|
|
452
453
|
canRead?: any;
|
|
453
454
|
setCanRead?: any;
|
|
455
|
+
notificationApp?: string
|
|
454
456
|
handleSend?: () => {};
|
|
455
457
|
setImage?: (image: string | null) => {};
|
|
456
458
|
setMessage?: (comment: string) => {};
|
|
@@ -376,6 +376,10 @@ const CheckoutUI = (props: any) => {
|
|
|
376
376
|
setShowTitle(contentOffset.y > 30)
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
const handleRedirect = () => {
|
|
380
|
+
props.fromProductsList ? navigation?.goBack() : onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)
|
|
381
|
+
}
|
|
382
|
+
|
|
379
383
|
useEffect(() => {
|
|
380
384
|
if (validationFields && validationFields?.fields?.checkout && !user?.guest_id) {
|
|
381
385
|
checkValidationFields()
|
|
@@ -491,7 +495,7 @@ const CheckoutUI = (props: any) => {
|
|
|
491
495
|
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
492
496
|
<View style={styles.wrapperNavbar}>
|
|
493
497
|
<TopHeader>
|
|
494
|
-
<TopActions onPress={() =>
|
|
498
|
+
<TopActions onPress={() => handleRedirect()}>
|
|
495
499
|
<IconAntDesign
|
|
496
500
|
name='arrowleft'
|
|
497
501
|
size={26}
|
|
@@ -517,7 +521,7 @@ const CheckoutUI = (props: any) => {
|
|
|
517
521
|
hideArrowLeft
|
|
518
522
|
title={t('CHECKOUT', 'Checkout')}
|
|
519
523
|
titleAlign={'center'}
|
|
520
|
-
onActionLeft={() =>
|
|
524
|
+
onActionLeft={() => handleRedirect()}
|
|
521
525
|
showCall={false}
|
|
522
526
|
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
523
527
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|