ordering-ui-react-native 0.22.82 → 0.22.84
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/AcceptOrRejectOrder/index.tsx +9 -13
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/Chat/index.tsx +3 -1
- package/themes/business/src/components/OrderDetails/Business.tsx +6 -3
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +9 -2
- package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
- package/themes/business/src/components/OrdersOption/index.tsx +54 -46
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/utils/index.tsx +12 -0
package/package.json
CHANGED
|
@@ -428,19 +428,15 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
428
428
|
{action === 'accept' && (
|
|
429
429
|
<View style={{ height: 300, justifyContent: 'center' }}>
|
|
430
430
|
<Timer onPress={() => openTimerIOnput()}>
|
|
431
|
-
<
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
<
|
|
439
|
-
|
|
440
|
-
{min}
|
|
441
|
-
</OText>
|
|
442
|
-
<OText style={{ marginLeft: 10 }}>{t('MINUTES', 'Minutes')}</OText>
|
|
443
|
-
</View>
|
|
431
|
+
<OText weight="600" size={55}>
|
|
432
|
+
{hour}
|
|
433
|
+
</OText>
|
|
434
|
+
{hour.length > 0 && <OText size={55} style={{ marginBottom: 10 }}>:</OText>}
|
|
435
|
+
<OText weight="600" size={55}>
|
|
436
|
+
{min}
|
|
437
|
+
</OText>
|
|
438
|
+
{time?.length > 2 && <OText style={{ position: 'absolute', bottom: 60, left: 55 }}>{t('HOURS', 'Hours')}</OText>}
|
|
439
|
+
<OText style={{ position: 'absolute', bottom: 60, right: time?.length > 2 ? 55 : 95 }}>{t('MINUTES', 'Minutes')}</OText>
|
|
444
440
|
</Timer>
|
|
445
441
|
</View>
|
|
446
442
|
)}
|
|
@@ -96,7 +96,9 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
96
96
|
20: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Order customer almost arrived to business'),
|
|
97
97
|
21: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Order customer arrived to business'),
|
|
98
98
|
22: t('ORDER_LOOKING_FOR_DRIVER', 'Order looking for driver'),
|
|
99
|
-
23: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
|
|
99
|
+
23: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
100
|
+
24: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
|
|
101
|
+
25: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
const getLogisticTag = (status: any) => {
|
|
@@ -78,7 +78,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
78
78
|
const [printerSettings, setPrinterSettings] = useState<any>('')
|
|
79
79
|
const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
|
|
80
80
|
|
|
81
|
-
const orderToComplete = [4,
|
|
81
|
+
const orderToComplete = [4, 20, 21]
|
|
82
|
+
const orderToReady = [7, 14]
|
|
82
83
|
|
|
83
84
|
if (order?.status === 7 || order?.status === 4) {
|
|
84
85
|
if (drivers?.length > 0 && drivers) {
|
|
@@ -341,6 +342,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
341
342
|
};
|
|
342
343
|
|
|
343
344
|
const handleCloseModal = () => {
|
|
345
|
+
readMessages && readMessages()
|
|
346
|
+
loadMessages && loadMessages()
|
|
344
347
|
setOpenModalForBusiness(false);
|
|
345
348
|
};
|
|
346
349
|
|
|
@@ -485,6 +488,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
485
488
|
handleArrowBack={handleArrowBack}
|
|
486
489
|
isCustomView={props.isCustomView}
|
|
487
490
|
messages={messages}
|
|
491
|
+
messagesReadList={messagesReadList}
|
|
488
492
|
/>
|
|
489
493
|
<OrderDetailsContainer
|
|
490
494
|
keyboardShouldPersistTaps="handled"
|
|
@@ -633,7 +637,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
633
637
|
</>
|
|
634
638
|
<View style={{ height: 30 }} />
|
|
635
639
|
</OrderDetailsContainer>
|
|
636
|
-
|
|
637
640
|
{order &&
|
|
638
641
|
Object.keys(order).length > 0 &&
|
|
639
642
|
getOrderStatus(order?.status, t)?.value ===
|
|
@@ -650,7 +653,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
650
653
|
widthButton={'45%'}
|
|
651
654
|
/>
|
|
652
655
|
)}
|
|
653
|
-
{order?.status
|
|
656
|
+
{orderToReady.includes(order?.status) && (
|
|
654
657
|
<FloatingButton
|
|
655
658
|
btnText={t('READY_FOR_PICKUP', 'Ready for pickup')}
|
|
656
659
|
colorTxt1={theme.colors.primary}
|
|
@@ -24,7 +24,8 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
|
|
|
24
24
|
import {
|
|
25
25
|
useLanguage,
|
|
26
26
|
useUtils,
|
|
27
|
-
useConfig
|
|
27
|
+
useConfig,
|
|
28
|
+
useSession
|
|
28
29
|
} from 'ordering-components/native';
|
|
29
30
|
|
|
30
31
|
interface OrderHeader {
|
|
@@ -38,6 +39,7 @@ interface OrderHeader {
|
|
|
38
39
|
handleCopyClipboard?: any
|
|
39
40
|
isCustomView?: any
|
|
40
41
|
messages?: any
|
|
42
|
+
messagesReadList?: any
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
@@ -51,13 +53,18 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
51
53
|
handleViewSummaryOrder,
|
|
52
54
|
handleCopyClipboard,
|
|
53
55
|
messages,
|
|
56
|
+
messagesReadList
|
|
54
57
|
} = props
|
|
55
58
|
const theme = useTheme();
|
|
56
59
|
const [, t] = useLanguage();
|
|
57
60
|
const [configState] = useConfig()
|
|
61
|
+
const [{ user }] = useSession()
|
|
58
62
|
const [{ parseDate, parsePrice }] = useUtils();
|
|
59
63
|
const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
|
|
60
64
|
const showExternalId = configState?.configs?.change_order_id?.value === '1'
|
|
65
|
+
const messagesReadIds = messagesReadList?.map((message: any) => message?.order_message_id)
|
|
66
|
+
|
|
67
|
+
const filteredMessages = messagesReadList?.length > 0 ? messages?.messages?.filter((message: any) => !messagesReadIds?.includes(message?.id)) : messages?.messages
|
|
61
68
|
|
|
62
69
|
const styles = StyleSheet.create({
|
|
63
70
|
icons: {
|
|
@@ -196,7 +203,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
196
203
|
onClick={() => handleOpenMapView()}
|
|
197
204
|
/>
|
|
198
205
|
<Messages>
|
|
199
|
-
{
|
|
206
|
+
{filteredMessages?.filter((message: any) => message?.author_id !== user?.id && !message?.read)?.length > 0 && <Dot />}
|
|
200
207
|
<OIconButton
|
|
201
208
|
icon={theme.images.general.messages}
|
|
202
209
|
iconStyle={{
|
|
@@ -846,6 +846,14 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
|
|
|
846
846
|
{
|
|
847
847
|
key: 23,
|
|
848
848
|
text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
key: 24,
|
|
852
|
+
text: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order')
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
key: 25,
|
|
856
|
+
text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
|
|
849
857
|
}
|
|
850
858
|
],
|
|
851
859
|
tabs: [
|
|
@@ -858,7 +866,7 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
|
|
|
858
866
|
{
|
|
859
867
|
key: 1,
|
|
860
868
|
text: t('IN_PROGRESS', 'In Progress'),
|
|
861
|
-
tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
|
|
869
|
+
tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25],
|
|
862
870
|
title: 'inProgress',
|
|
863
871
|
},
|
|
864
872
|
{
|
|
@@ -393,12 +393,12 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
393
393
|
setTags({ values: [] })
|
|
394
394
|
}, [currentTabSelected])
|
|
395
395
|
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
useEffect(() => {
|
|
397
|
+
const unsubcribe = navigation.addListener('focus', () => {
|
|
398
398
|
currentTabSelected === 'logisticOrders' && loadLogisticOrders && loadLogisticOrders()
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
399
|
+
})
|
|
400
|
+
return unsubcribe
|
|
401
|
+
}, [navigation, loadLogisticOrders])
|
|
402
402
|
|
|
403
403
|
useEffect(() => {
|
|
404
404
|
const orderStatuses = ['active', 'pending', 'inProgress', 'completed', 'cancelled']
|
|
@@ -675,34 +675,34 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
675
675
|
!currentOrdersGroup?.orders?.length
|
|
676
676
|
) || internetLoading
|
|
677
677
|
) && (
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
style={{
|
|
683
|
-
width: '100%',
|
|
684
|
-
flexDirection: 'row',
|
|
685
|
-
marginBottom: 10,
|
|
686
|
-
}}>
|
|
687
|
-
<PlaceholderLine
|
|
688
|
-
width={IS_PORTRAIT ? 22 : 11}
|
|
689
|
-
height={74}
|
|
678
|
+
<View>
|
|
679
|
+
{[...Array(5)].map((_, i) => (
|
|
680
|
+
<Placeholder key={i} Animation={Fade}>
|
|
681
|
+
<View
|
|
690
682
|
style={{
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
}}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
683
|
+
width: '100%',
|
|
684
|
+
flexDirection: 'row',
|
|
685
|
+
marginBottom: 10,
|
|
686
|
+
}}>
|
|
687
|
+
<PlaceholderLine
|
|
688
|
+
width={IS_PORTRAIT ? 22 : 11}
|
|
689
|
+
height={74}
|
|
690
|
+
style={{
|
|
691
|
+
marginRight: 20,
|
|
692
|
+
marginBottom: 20,
|
|
693
|
+
borderRadius: 7.6,
|
|
694
|
+
}}
|
|
695
|
+
/>
|
|
696
|
+
<Placeholder>
|
|
697
|
+
<PlaceholderLine width={30} style={{ marginTop: 5 }} />
|
|
698
|
+
<PlaceholderLine width={50} />
|
|
699
|
+
<PlaceholderLine width={20} />
|
|
700
|
+
</Placeholder>
|
|
701
|
+
</View>
|
|
702
|
+
</Placeholder>
|
|
703
|
+
))}
|
|
704
|
+
</View>
|
|
705
|
+
)}
|
|
706
706
|
|
|
707
707
|
{isNetConnected &&
|
|
708
708
|
!currentOrdersGroup?.error?.length &&
|
|
@@ -724,22 +724,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
724
724
|
|
|
725
725
|
{!internetLoading &&
|
|
726
726
|
((!currentOrdersGroup?.loading &&
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
727
|
+
(currentOrdersGroup?.error?.length ||
|
|
728
|
+
currentOrdersGroup?.orders?.length === 0)) ||
|
|
729
|
+
(currentTabSelected === 'logisticOrders' &&
|
|
730
|
+
(logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired)))
|
|
731
|
+
) &&
|
|
732
732
|
(
|
|
733
733
|
<NotFoundSource
|
|
734
734
|
content={
|
|
735
735
|
!isNetConnected ? t('NETWORK_ERROR', 'Network Error') :
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
736
|
+
((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
|
|
737
|
+
(currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
|
|
738
|
+
? t('NO_RESULTS_FOUND', 'Sorry, no results found')
|
|
739
|
+
: currentOrdersGroup?.error?.[0]?.message ||
|
|
740
|
+
currentOrdersGroup?.error?.[0] ||
|
|
741
|
+
(currentTabSelected === 'logisticOrders' && logisticOrders?.error) ||
|
|
742
|
+
t('NETWORK_ERROR', 'Network Error')
|
|
743
743
|
}
|
|
744
744
|
image={theme.images.general.notFound}
|
|
745
745
|
conditioned={false}
|
|
@@ -1117,13 +1117,21 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1117
1117
|
{
|
|
1118
1118
|
key: 23,
|
|
1119
1119
|
text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
key: 24,
|
|
1123
|
+
text: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order')
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
key: 25,
|
|
1127
|
+
text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
|
|
1120
1128
|
}
|
|
1121
1129
|
],
|
|
1122
1130
|
tabs: combineTabs ? [
|
|
1123
1131
|
{
|
|
1124
1132
|
key: 0,
|
|
1125
1133
|
text: t('ACTIVE', 'Active'),
|
|
1126
|
-
tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
|
|
1134
|
+
tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25],
|
|
1127
1135
|
title: 'active',
|
|
1128
1136
|
},
|
|
1129
1137
|
{
|
|
@@ -1149,7 +1157,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
1149
1157
|
{
|
|
1150
1158
|
key: 1,
|
|
1151
1159
|
text: t('IN_PROGRESS', 'In Progress'),
|
|
1152
|
-
tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
|
|
1160
|
+
tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25],
|
|
1153
1161
|
title: 'inProgress',
|
|
1154
1162
|
},
|
|
1155
1163
|
{
|
|
@@ -201,6 +201,18 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
|
|
|
201
201
|
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
202
202
|
slug: 'ORDER_DRIVER_ON_WAY',
|
|
203
203
|
percentage: 45
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
key: 24,
|
|
207
|
+
value: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
|
|
208
|
+
slug: 'ORDER_DRIVER_WAITING_FOR_ORDER',
|
|
209
|
+
percentage: 25
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
key: 25,
|
|
213
|
+
value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
|
|
214
|
+
slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
|
|
215
|
+
percentage: 25
|
|
204
216
|
}
|
|
205
217
|
];
|
|
206
218
|
|
|
@@ -344,6 +344,18 @@ export const getOrderStatus = (s: string, t: any) => {
|
|
|
344
344
|
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
345
345
|
slug: 'ORDER_DRIVER_ON_WAY',
|
|
346
346
|
percentage: 45
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
key: 24,
|
|
350
|
+
value: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
|
|
351
|
+
slug: 'ORDER_DRIVER_WAITING_FOR_ORDER',
|
|
352
|
+
percentage: 25
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
key: 25,
|
|
356
|
+
value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
|
|
357
|
+
slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
|
|
358
|
+
percentage: 25
|
|
347
359
|
}
|
|
348
360
|
];
|
|
349
361
|
|