ordering-ui-react-native 0.23.65 → 0.23.67
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
CHANGED
|
@@ -65,7 +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
|
+
const cateringTypes : any = [7, 8]
|
|
69
69
|
|
|
70
70
|
const styles = StyleSheet.create({
|
|
71
71
|
icons: {
|
|
@@ -154,17 +154,6 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
154
154
|
return paymethodsList.join(', ')
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
const deliveryDate = () => {
|
|
158
|
-
const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
|
|
159
|
-
const currentDate = new Date();
|
|
160
|
-
const receivedDate: any = new Date(order?.delivery_datetime);
|
|
161
|
-
|
|
162
|
-
const formattedDate = receivedDate <= currentDate
|
|
163
|
-
? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
|
|
164
|
-
: parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
|
|
165
|
-
return formattedDate
|
|
166
|
-
}
|
|
167
|
-
|
|
168
157
|
return (
|
|
169
158
|
<>
|
|
170
159
|
{!props.isCustomView && (
|
|
@@ -231,7 +220,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
231
220
|
<OText size={13} style={{ marginBottom: 5 }}>
|
|
232
221
|
<>
|
|
233
222
|
{cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
|
|
234
|
-
{
|
|
223
|
+
{order?.delivery_datetime_utc && (
|
|
224
|
+
<>{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} {parseDate(order?.delivery_datetime_utc)}</>
|
|
225
|
+
)}
|
|
226
|
+
{order?.delivery_datetime && (
|
|
227
|
+
<>{'\n'}{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} {parseDate(order?.delivery_datetime, { utc: false })} {`(${t('BUSINESS_TIME', 'Business time')})`}</>
|
|
228
|
+
)}
|
|
235
229
|
</>
|
|
236
230
|
</OText>
|
|
237
231
|
) : (
|
|
@@ -239,7 +233,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
239
233
|
<OText size={13} style={{ marginBottom: 5 }}>
|
|
240
234
|
<>
|
|
241
235
|
{cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
|
|
242
|
-
{
|
|
236
|
+
{order?.delivery_datetime_utc && (
|
|
237
|
+
<>{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} {parseDate(order?.delivery_datetime_utc)}</>
|
|
238
|
+
)}
|
|
239
|
+
{order?.delivery_datetime && (
|
|
240
|
+
<>{'\n'}{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} {parseDate(order?.delivery_datetime, { utc: false })} {`(${t('BUSINESS_TIME', 'Business time')})`}</>
|
|
241
|
+
)}
|
|
243
242
|
</>
|
|
244
243
|
</OText>
|
|
245
244
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity } from 'react-native';
|
|
2
|
+
import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity, Animated, Easing } from 'react-native';
|
|
3
3
|
import { useLanguage, useUtils, OrderListGroups, useConfig } from 'ordering-components/native';
|
|
4
4
|
import SelectDropdown from 'react-native-select-dropdown'
|
|
5
5
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
@@ -139,6 +139,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
139
139
|
const HEIGHT_SCREEN = orientationState?.dimensions?.height
|
|
140
140
|
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
141
141
|
const showTagsList = !props.isAlsea && !props.isDriverApp && currentTabSelected !== 'logisticOrders'
|
|
142
|
+
const AnimatedFeatherIcon = Animated.createAnimatedComponent(FeatherIcon);
|
|
143
|
+
const spinValue = new Animated.Value(0);
|
|
142
144
|
|
|
143
145
|
const preorderTypeList = [
|
|
144
146
|
{ key: null, name: t('SLA', 'SLA\'s') },
|
|
@@ -468,6 +470,25 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
468
470
|
}
|
|
469
471
|
}, [isNetConnected, JSON.stringify(offlineActionsState.orders)]);
|
|
470
472
|
|
|
473
|
+
|
|
474
|
+
const handleInitAnimation = () => {
|
|
475
|
+
Animated.timing(
|
|
476
|
+
spinValue,
|
|
477
|
+
{
|
|
478
|
+
toValue: 1,
|
|
479
|
+
duration: 2000,
|
|
480
|
+
easing: Easing.linear,
|
|
481
|
+
useNativeDriver: true
|
|
482
|
+
}
|
|
483
|
+
).start()
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
useEffect(() => {
|
|
487
|
+
if (currentOrdersGroup?.loading || logisticOrders?.loading){
|
|
488
|
+
handleInitAnimation()
|
|
489
|
+
}
|
|
490
|
+
}, [currentOrdersGroup?.loading, logisticOrders?.loading])
|
|
491
|
+
|
|
471
492
|
return (
|
|
472
493
|
<>
|
|
473
494
|
<View style={styles.header}>
|
|
@@ -477,12 +498,20 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
477
498
|
<WebsocketStatus />
|
|
478
499
|
</View>
|
|
479
500
|
{isNetConnected && (
|
|
480
|
-
<
|
|
501
|
+
<AnimatedFeatherIcon
|
|
481
502
|
name='refresh-cw'
|
|
482
503
|
color={theme.colors.backgroundDark}
|
|
483
504
|
size={24}
|
|
484
|
-
onPress={() =>
|
|
485
|
-
style={{
|
|
505
|
+
onPress={() => currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })}
|
|
506
|
+
style={{
|
|
507
|
+
marginRight: 20,
|
|
508
|
+
transform: [{
|
|
509
|
+
rotate: spinValue.interpolate({
|
|
510
|
+
inputRange: [0, 0.3],
|
|
511
|
+
outputRange: ['0deg', '360deg'],
|
|
512
|
+
})
|
|
513
|
+
}]
|
|
514
|
+
}}
|
|
486
515
|
/>
|
|
487
516
|
)}
|
|
488
517
|
<FontistoIcon
|