ordering-ui-react-native 0.23.13 → 0.23.15-test
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/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/OrderDetails/Business.tsx +16 -1
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +9 -2
- package/themes/business/src/components/PreviousMessages/index.tsx +8 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +2 -1
- package/themes/business/src/components/PrinterEdition/index.tsx +5 -1
- package/themes/original/src/components/OrderDetails/index.tsx +7 -4
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { StyleSheet, View, ActivityIndicator, TouchableOpacity } from 'react-native';
|
|
3
|
+
import FastImage from 'react-native-fast-image'
|
|
3
4
|
import ToggleSwitch from 'toggle-switch-react-native';
|
|
4
5
|
import { useTheme } from 'styled-components/native';
|
|
5
6
|
import {
|
|
@@ -99,10 +100,14 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
99
100
|
onPress={() => navigation && business?.slug && navigation.navigate('BusinessProductListing', { slug: business?.slug })}
|
|
100
101
|
>
|
|
101
102
|
<Logo style={styles.logo}>
|
|
102
|
-
<
|
|
103
|
-
url={optimizeImage(business?.logo, 'h_300,c_limit')}
|
|
104
|
-
src={!business?.logo && theme?.images?.dummies?.businessLogo}
|
|
103
|
+
<FastImage
|
|
105
104
|
style={styles.icon}
|
|
105
|
+
source={business?.logo?.includes('https') ? {
|
|
106
|
+
uri: business?.logo,
|
|
107
|
+
priority: FastImage.priority.high,
|
|
108
|
+
cache: FastImage.cacheControl.immutable
|
|
109
|
+
} : business?.logo ?? theme?.images?.dummies?.businessLogo}
|
|
110
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
106
111
|
/>
|
|
107
112
|
</Logo>
|
|
108
113
|
<Information>
|
|
@@ -316,8 +316,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
316
316
|
const printAction = async (printerSettings: any, commands: any, showAlert: boolean = true) => {
|
|
317
317
|
try {
|
|
318
318
|
var printResult = await StarPRNT.print(printerSettings?.emulation, commands, printerSettings?.portName);
|
|
319
|
+
Alert.alert(
|
|
320
|
+
'Print Result',
|
|
321
|
+
JSON.stringify(printResult),
|
|
322
|
+
[{ text: t('OK', 'Ok')}]
|
|
323
|
+
)
|
|
319
324
|
showAlert && showToast(ToastType.Info, t('ORDER_PRINTED_SUCCESS', 'Order printed'), 1000)
|
|
320
325
|
} catch (e) {
|
|
326
|
+
Alert.alert(
|
|
327
|
+
'Print Result',
|
|
328
|
+
JSON.stringify(e),
|
|
329
|
+
[{ text: t('OK', 'Ok')}]
|
|
330
|
+
)
|
|
321
331
|
showAlert && showToast(ToastType.Error, t('ORDER_PRINTED_FAILED', 'Order not printed, connection failed'), 1000)
|
|
322
332
|
}
|
|
323
333
|
}
|
|
@@ -330,7 +340,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
330
340
|
orderStatus: getOrderStatus(order?.status, t)?.value
|
|
331
341
|
}, printer?.printMode)
|
|
332
342
|
commands.push({ appendCutPaper: StarPRNT.CutPaperAction.PartialCutWithFeed })
|
|
333
|
-
|
|
343
|
+
Alert.alert(
|
|
344
|
+
`Printer: ${printer?.model}`,
|
|
345
|
+
`Port name: ${printer?.portName}`,
|
|
346
|
+
[{ text: t('OK', 'Ok')}]
|
|
347
|
+
)
|
|
334
348
|
printAction(printer, commands, idx === printerSettings.length - 1)
|
|
335
349
|
})
|
|
336
350
|
return
|
|
@@ -423,6 +437,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
423
437
|
const autoPrint = await _retrieveStoreData('auto_print_after_accept_order')
|
|
424
438
|
setPrinterSettings(printers?.length && printers)
|
|
425
439
|
setAutoPrintEnabled(!!autoPrint)
|
|
440
|
+
console.log('printers after', printers);
|
|
426
441
|
}
|
|
427
442
|
|
|
428
443
|
getStorageData()
|
|
@@ -65,6 +65,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
65
65
|
const messagesReadIds = messagesReadList?.map((message: any) => message?.order_message_id)
|
|
66
66
|
|
|
67
67
|
const filteredMessages = messagesReadList?.length > 0 ? messages?.messages?.filter((message: any) => !messagesReadIds?.includes(message?.id)) : messages?.messages
|
|
68
|
+
const cateringTypes = [7, 8]
|
|
68
69
|
|
|
69
70
|
const styles = StyleSheet.create({
|
|
70
71
|
icons: {
|
|
@@ -228,12 +229,18 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
228
229
|
<OrderHeader>
|
|
229
230
|
{!props.isCustomView ? (
|
|
230
231
|
<OText size={13} style={{ marginBottom: 5 }}>
|
|
231
|
-
|
|
232
|
+
<>
|
|
233
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
|
|
234
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}: ` : ''}{deliveryDate()}
|
|
235
|
+
</>
|
|
232
236
|
</OText>
|
|
233
237
|
) : (
|
|
234
238
|
<Header style={{ alignItems: 'center' }}>
|
|
235
239
|
<OText size={13} style={{ marginBottom: 5 }}>
|
|
236
|
-
|
|
240
|
+
<>
|
|
241
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
|
|
242
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}: ` : ''}{deliveryDate()}
|
|
243
|
+
</>
|
|
237
244
|
</OText>
|
|
238
245
|
|
|
239
246
|
{(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { StyleSheet, TouchableOpacity, FlatList, RefreshControl } from 'react-native';
|
|
3
|
+
import FastImage from 'react-native-fast-image';
|
|
3
4
|
import { useTheme } from 'styled-components/native';
|
|
4
5
|
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
6
|
import { Card, Logo, Information, Header, Badge } from './styles';
|
|
@@ -302,10 +303,14 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
|
|
|
302
303
|
activeOpacity={1}>
|
|
303
304
|
<Card key={order?.id}>
|
|
304
305
|
<Logo style={styles.logo}>
|
|
305
|
-
<
|
|
306
|
-
url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
|
|
307
|
-
src={!order?.business?.logo && theme?.images?.dummies?.businessLogo}
|
|
306
|
+
<FastImage
|
|
308
307
|
style={styles.icon}
|
|
308
|
+
source={order.business?.logo?.includes('https') ? {
|
|
309
|
+
uri: order.business?.logo,
|
|
310
|
+
priority: FastImage.priority.high,
|
|
311
|
+
cache: FastImage.cacheControl.immutable
|
|
312
|
+
} : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
|
|
313
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
309
314
|
/>
|
|
310
315
|
</Logo>
|
|
311
316
|
<Information>
|
|
@@ -171,7 +171,8 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
171
171
|
style={styles.icon}
|
|
172
172
|
source={order.business?.logo?.includes('https') ? {
|
|
173
173
|
uri: order.business?.logo,
|
|
174
|
-
priority: FastImage.priority.
|
|
174
|
+
priority: FastImage.priority.high,
|
|
175
|
+
cache: FastImage.cacheControl.immutable
|
|
175
176
|
} : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
|
|
176
177
|
resizeMode={FastImage.resizeMode.cover}
|
|
177
178
|
/>
|
|
@@ -63,9 +63,13 @@ export const PrinterEdition = (props: any) => {
|
|
|
63
63
|
paddingRight: 10
|
|
64
64
|
},
|
|
65
65
|
inputStyle: {
|
|
66
|
-
height: 40,
|
|
67
66
|
borderWidth: 1,
|
|
68
67
|
borderRadius: 8,
|
|
68
|
+
color: theme.colors.arrowColor,
|
|
69
|
+
borderColor: theme.colors.inputSignup,
|
|
70
|
+
backgroundColor: theme.colors.transparent,
|
|
71
|
+
minHeight: 50,
|
|
72
|
+
maxHeight: 50
|
|
69
73
|
},
|
|
70
74
|
savePrinterBtnText: {
|
|
71
75
|
color: theme.colors.white,
|
|
@@ -134,6 +134,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
134
134
|
const directionTypes = [2, 3, 4, 5]
|
|
135
135
|
const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26]
|
|
136
136
|
const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
|
|
137
|
+
const cateringTypes = [7, 8]
|
|
137
138
|
const [isPickup, setIsPickup] = useState(order?.delivery_type === 2)
|
|
138
139
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
139
140
|
const isGiftCardOrder = !order?.business_id
|
|
@@ -361,7 +362,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
361
362
|
}
|
|
362
363
|
}, [props?.order?.error, props?.order?.loading])
|
|
363
364
|
|
|
364
|
-
|
|
365
365
|
useEffect(() => {
|
|
366
366
|
if (!order?.delivery_type) return
|
|
367
367
|
setIsPickup(order?.delivery_type === 2)
|
|
@@ -461,15 +461,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
461
461
|
<NavBar
|
|
462
462
|
hideArrowLeft
|
|
463
463
|
title={`${t('ORDER', 'Order')} #${order?.id}`}
|
|
464
|
-
titleAlign={'
|
|
464
|
+
titleAlign={'left'}
|
|
465
465
|
showCall={false}
|
|
466
466
|
btnStyle={{ paddingLeft: 0 }}
|
|
467
467
|
style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
|
|
468
468
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
469
|
-
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
469
|
+
titleStyle={{ marginRight: 0, marginLeft: 0, paddingHorizontal: 0 }}
|
|
470
470
|
subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
471
471
|
{activeStatus.includes(order?.status) ? (
|
|
472
|
-
|
|
472
|
+
<>
|
|
473
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
|
|
474
|
+
{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} <OrderEta order={order} />
|
|
475
|
+
</>
|
|
473
476
|
) : (
|
|
474
477
|
parseDate(order?.reporting_data?.at[`status:${order.status}`])
|
|
475
478
|
)}
|