ordering-ui-react-native 0.10.3 → 0.11.3

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.
Files changed (35) hide show
  1. package/package.json +2 -1
  2. package/themes/business/index.tsx +12 -12
  3. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +49 -43
  4. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +4 -10
  5. package/themes/business/src/components/Chat/index.tsx +97 -60
  6. package/themes/business/src/components/DriverMap/index.tsx +196 -183
  7. package/themes/business/src/components/FloatingButton/index.tsx +61 -43
  8. package/themes/business/src/components/FloatingButton/styles.tsx +2 -5
  9. package/themes/business/src/components/GoogleMap/index.tsx +10 -8
  10. package/themes/business/src/components/Home/index.tsx +2 -5
  11. package/themes/business/src/components/Home/styles.tsx +1 -2
  12. package/themes/business/src/components/LanguageSelector/index.tsx +1 -3
  13. package/themes/business/src/components/MessagesOption/index.tsx +13 -18
  14. package/themes/business/src/components/MessagesOption/styles.tsx +3 -0
  15. package/themes/business/src/components/OrderDetails/Business.tsx +642 -0
  16. package/themes/business/src/components/OrderDetails/Delivery.tsx +436 -0
  17. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +378 -0
  18. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +148 -0
  19. package/themes/business/src/components/OrderDetails/styles.tsx +16 -74
  20. package/themes/business/src/components/OrderMessage/index.tsx +5 -2
  21. package/themes/business/src/components/OrdersOption/index.tsx +344 -302
  22. package/themes/business/src/components/OrdersOption/styles.tsx +4 -2
  23. package/themes/business/src/components/PreviousMessages/index.tsx +15 -8
  24. package/themes/business/src/components/PreviousOrders/index.tsx +86 -141
  25. package/themes/business/src/components/PreviousOrders/styles.tsx +4 -3
  26. package/themes/business/src/components/UserProfileForm/index.tsx +73 -6
  27. package/themes/business/src/components/UserProfileForm/styles.tsx +0 -2
  28. package/themes/business/src/components/shared/OModal.tsx +9 -7
  29. package/themes/business/src/components/shared/OTextarea.tsx +2 -1
  30. package/themes/business/src/layouts/SafeAreaContainer.tsx +2 -2
  31. package/themes/business/src/types/index.tsx +24 -13
  32. package/themes/business/src/utils/index.tsx +160 -0
  33. package/themes/business/src/components/OrderDetails/index.tsx +0 -1262
  34. package/themes/business/src/components/OrderDetailsDelivery/index.tsx +0 -1056
  35. package/themes/business/src/components/OrderDetailsDelivery/styles.tsx +0 -142
@@ -0,0 +1,642 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import {
3
+ StyleSheet,
4
+ View,
5
+ TouchableOpacity,
6
+ ActivityIndicator,
7
+ } from 'react-native';
8
+ import Clipboard from '@react-native-clipboard/clipboard';
9
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
10
+ import { useTheme } from 'styled-components/native';
11
+ import {
12
+ ToastType,
13
+ useToast,
14
+ useLanguage,
15
+ OrderDetails as OrderDetailsController,
16
+ useUtils,
17
+ useConfig,
18
+ useSession,
19
+ } from 'ordering-components/native';
20
+ import {
21
+ OrderDetailsContainer,
22
+ Pickup,
23
+ AssignDriver,
24
+ DriverItem,
25
+ } from './styles';
26
+ import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
27
+ import { Chat } from '../Chat';
28
+ import { FloatingButton } from '../FloatingButton';
29
+ import { GoogleMap } from '../GoogleMap';
30
+ import { OButton, OModal, OText, OIcon } from '../shared';
31
+ import { OrderDetailsParams } from '../../types';
32
+ import { verifyDecimals, getProductPrice } from '../../utils';
33
+ import { USER_TYPE } from '../../config/constants';
34
+ import CountryPicker from 'react-native-country-picker-modal';
35
+ import { NotFoundSource } from '../NotFoundSource';
36
+ import { OrderHeaderComponent } from './OrderHeaderComponent';
37
+ import { OrderContentComponent } from './OrderContentComponent';
38
+ import { getOrderStatus } from '../../utils';
39
+
40
+ export const OrderDetailsUI = (props: OrderDetailsParams) => {
41
+ const {
42
+ navigation,
43
+ messages,
44
+ setMessages,
45
+ readMessages,
46
+ messagesReadList,
47
+ handleAssignDriver,
48
+ handleChangeOrderStatus,
49
+ isFromCheckout,
50
+ driverLocation,
51
+ actions,
52
+ titleAccept,
53
+ titleReject,
54
+ appTitle,
55
+ } = props;
56
+
57
+ const theme = useTheme();
58
+ const [, t] = useLanguage();
59
+ const [{ parsePrice, parseNumber, parseDate }] = useUtils();
60
+ const [{ user, token }] = useSession();
61
+ const [{ configs }] = useConfig();
62
+ const [, { showToast }] = useToast();
63
+ const [unreadAlert, setUnreadAlert] = useState({
64
+ business: false,
65
+ driver: false,
66
+ });
67
+ const { order, businessData, loading, error } = props.order;
68
+ const { drivers, loadingDriver } = props.drivers;
69
+ const itemsDrivers: any = [];
70
+ const [actionOrder, setActionOrder] = useState('');
71
+ const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
72
+ const [openModalForAccept, setOpenModalForAccept] = useState(false);
73
+ const [openModalForMapView, setOpenModalForMapView] = useState(false);
74
+ const [isDriverModalVisible, setIsDriverModalVisible] = useState(false);
75
+
76
+ if (order?.status === 7 || order?.status === 4) {
77
+ if (drivers?.length > 0 && drivers) {
78
+ drivers.forEach((driver: any) => {
79
+ itemsDrivers.push({
80
+ available: driver?.available,
81
+ key: driver?.id,
82
+ value: driver?.id,
83
+ label: driver?.name,
84
+ });
85
+ });
86
+
87
+ if (
88
+ !drivers?.some((driver: any) => driver?.id === order?.driver?.id) &&
89
+ order?.driver?.id
90
+ ) {
91
+ itemsDrivers.push({
92
+ available: order?.driver?.available,
93
+ key: order?.driver?.id,
94
+ value: order?.driver?.id,
95
+ label: order?.driver?.name,
96
+ });
97
+ }
98
+ }
99
+
100
+ if (order?.driver && (!drivers?.length || drivers?.length === 0)) {
101
+ itemsDrivers.push({
102
+ available: order?.driver?.available,
103
+ key: order?.driver?.id,
104
+ value: order?.driver?.id,
105
+ label: order?.driver?.name,
106
+ });
107
+ }
108
+
109
+ if (order?.driver) {
110
+ itemsDrivers.push({
111
+ available: true,
112
+ key: null,
113
+ value: null,
114
+ label: t('UNASSIGN_DRIVER', 'Unassign Driver'),
115
+ });
116
+ }
117
+
118
+ if (itemsDrivers.length > 0) {
119
+ itemsDrivers.sort((a: any, b: any) => {
120
+ if (a.available > b.available) return -1;
121
+ });
122
+ }
123
+ }
124
+
125
+ const handleCopyClipboard = () => {
126
+ const businessName = !!order?.business?.name
127
+ ? `${order?.business?.name} \n`
128
+ : '';
129
+
130
+ const businessEmail = !!order?.business?.email
131
+ ? `${order?.business?.email} \n`
132
+ : '';
133
+
134
+ const businessCellphone = !!order?.business?.cellphone
135
+ ? `${order?.business?.cellphone} \n`
136
+ : '';
137
+
138
+ const businessPhone = !!order?.business?.phone
139
+ ? `${order?.business?.phone} \n`
140
+ : '';
141
+
142
+ const businessAddress = !!order?.business?.address
143
+ ? `${order?.business?.address} \n`
144
+ : '';
145
+
146
+ const businessSpecialAddress = !!order?.business?.address_notes
147
+ ? `${order?.business?.address_notes} \n \n`
148
+ : '';
149
+
150
+ const customerName = !!order?.customer?.name
151
+ ? `${order?.customer?.name} ${order?.customer?.middle_name || ''} ${
152
+ order?.customer?.lastname || ''
153
+ } ${order?.customer?.second_lastname || ''} \n`
154
+ : '';
155
+
156
+ const customerEmail = !!order?.customer.email
157
+ ? `${order?.customer.email} \n`
158
+ : '';
159
+
160
+ const customerCellPhone = !!order?.customer?.cellphone
161
+ ? `${order?.customer?.cellphone} \n`
162
+ : '';
163
+
164
+ const customerPhone = !!order?.customer?.phone
165
+ ? `${order?.customer?.phone} \n`
166
+ : '';
167
+
168
+ const customerAddress = !!order?.customer?.address
169
+ ? `${order?.customer?.address} \n`
170
+ : '';
171
+
172
+ const customerSpecialAddress = !!order?.customer?.address_notes
173
+ ? `${order?.customer?.address_notes} \n`
174
+ : '';
175
+
176
+ const payment = order?.paymethod?.name
177
+ ? `${order?.paymethod?.name} - ${
178
+ order.delivery_type === 1
179
+ ? t('DELIVERY', 'Delivery')
180
+ : order.delivery_type === 2
181
+ ? t('PICKUP', 'Pickup')
182
+ : order.delivery_type === 3
183
+ ? t('EAT_IN', 'Eat in')
184
+ : order.delivery_type === 4
185
+ ? t('CURBSIDE', 'Curbside')
186
+ : t('DRIVER_THRU', 'Driver thru')
187
+ }\n`
188
+ : '';
189
+ const productsInArray =
190
+ order?.products.length &&
191
+ order?.products.map((product: any, i: number) => {
192
+ return ` ${product?.quantity} X ${product?.name} ${parsePrice(
193
+ product.total ?? getProductPrice(product),
194
+ )}\n`;
195
+ });
196
+
197
+ const productsInString = productsInArray.join(' ');
198
+ const orderDetails = `${t(
199
+ 'ORDER_DETAILS',
200
+ 'Order Details',
201
+ )}:\n${productsInString}\n`;
202
+
203
+ const subtotal = `${t('SUBTOTAL', 'Subtotal')}: ${parsePrice(
204
+ order?.subtotal,
205
+ )}\n`;
206
+
207
+ const drivertip = `${t('DRIVER_TIP', 'Driver tip')} ${parsePrice(
208
+ order?.summary?.driver_tip || order?.totalDriverTip,
209
+ )}\n`;
210
+
211
+ const deliveryFee = `${t('DELIVERY_FEE', 'Delivery fee')} ${verifyDecimals(
212
+ order?.service_fee,
213
+ parseNumber,
214
+ )}% ${parsePrice(order?.summary?.service_fee || order?.serviceFee || 0)}\n`;
215
+
216
+ const total = `${t('TOTAL', 'Total')} ${parsePrice(
217
+ order?.summary?.total || order?.total,
218
+ )}\n`;
219
+
220
+ const orderStatus = `${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id} ${t(
221
+ 'IS',
222
+ 'is',
223
+ )} ${getOrderStatus(order?.status, t)?.value}\n`;
224
+
225
+ Clipboard.setString(
226
+ `${orderStatus} ${payment} ${t(
227
+ 'BUSINESS_DETAILS',
228
+ 'Business Details',
229
+ )}\n ${businessName} ${businessEmail} ${businessCellphone} ${businessPhone} ${businessAddress} ${businessSpecialAddress}${t(
230
+ 'CUSTOMER_DETAILS',
231
+ 'Customer Details',
232
+ )}\n ${customerName} ${customerEmail} ${customerCellPhone} ${customerPhone} ${customerAddress} ${customerSpecialAddress}\n${orderDetails} ${subtotal} ${drivertip} ${deliveryFee} ${total}`,
233
+ );
234
+
235
+ showToast(
236
+ ToastType.Info,
237
+ t('COPY_TO_CLIPBOARD', 'Copy to clipboard.'),
238
+ 1000,
239
+ );
240
+ };
241
+
242
+ const handleOpenMessagesForBusiness = () => {
243
+ setOpenModalForBusiness(true);
244
+ readMessages && readMessages();
245
+ setUnreadAlert({ ...unreadAlert, business: false });
246
+ };
247
+
248
+ const handleViewActionOrder = (action: string) => {
249
+ if (openModalForMapView) {
250
+ setOpenModalForMapView(false);
251
+ }
252
+ setActionOrder(action);
253
+ setOpenModalForAccept(true);
254
+ };
255
+
256
+ const handleViewSummaryOrder = () => {
257
+ navigation?.navigate &&
258
+ navigation.navigate('OrderSummary', {
259
+ order,
260
+ orderStatus: getOrderStatus(order?.status, t)?.value,
261
+ });
262
+ };
263
+
264
+ const handleCloseModal = () => {
265
+ setOpenModalForBusiness(false);
266
+ };
267
+
268
+ const handleOpenMapView = () => {
269
+ setOpenModalForMapView(!openModalForMapView);
270
+ };
271
+
272
+ const handleArrowBack: any = () => {
273
+ navigation?.canGoBack() && navigation.goBack();
274
+ };
275
+
276
+ useEffect(() => {
277
+ if (messagesReadList?.length) {
278
+ openModalForBusiness
279
+ ? setUnreadAlert({ ...unreadAlert, business: false })
280
+ : setUnreadAlert({ ...unreadAlert, driver: false });
281
+ }
282
+ }, [messagesReadList]);
283
+
284
+ const locations = [
285
+ {
286
+ ...order?.driver?.location,
287
+ title: t('DRIVER', 'Driver'),
288
+ icon:
289
+ order?.driver?.photo ||
290
+ 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png',
291
+ level: 4,
292
+ },
293
+ {
294
+ ...order?.business?.location,
295
+ title: order?.business?.name,
296
+ icon: order?.business?.logo || theme.images.dummies.businessLogo,
297
+ level: 2,
298
+ },
299
+ {
300
+ ...order?.customer?.location,
301
+ title: t('CUSTOMER', 'Customer'),
302
+ icon:
303
+ order?.customer?.photo ||
304
+ 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
305
+ level: 3,
306
+ },
307
+ ];
308
+
309
+ useEffect(() => {
310
+ if (openModalForAccept) {
311
+ setOpenModalForAccept(false);
312
+ }
313
+
314
+ if (openModalForMapView) {
315
+ setOpenModalForMapView(false);
316
+ }
317
+ }, [loading]);
318
+
319
+ const showFloatButtonsAcceptOrReject: any = {
320
+ 0: true,
321
+ };
322
+
323
+ useEffect(() => {
324
+ if (driverLocation) {
325
+ locations[0] = { ...locations[0], driverLocation };
326
+ }
327
+ }, [driverLocation]);
328
+
329
+ const styles = StyleSheet.create({
330
+ driverOff: {
331
+ backgroundColor: theme.colors.notAvailable,
332
+ },
333
+ btnPickUp: {
334
+ borderWidth: 0,
335
+ backgroundColor: theme.colors.btnBGWhite,
336
+ borderRadius: 8,
337
+ },
338
+ });
339
+
340
+ const locationsToSend = locations.filter(
341
+ (location: any) => location?.lat && location?.lng,
342
+ );
343
+
344
+ return (
345
+ <>
346
+ {(!order || Object.keys(order).length === 0) &&
347
+ (error?.length < 1 || !error) && (
348
+ <View
349
+ style={{
350
+ backgroundColor: theme.colors.backgroundLight,
351
+ }}>
352
+ {[...Array(6)].map((item, i) => (
353
+ <Placeholder key={i} Animation={Fade}>
354
+ <View style={{ flexDirection: 'row', marginBottom: 30 }}>
355
+ <Placeholder>
356
+ <PlaceholderLine width={90} />
357
+ <PlaceholderLine width={50} />
358
+ <PlaceholderLine width={20} />
359
+ <PlaceholderLine width={10} />
360
+ </Placeholder>
361
+ </View>
362
+ </Placeholder>
363
+ ))}
364
+ </View>
365
+ )}
366
+
367
+ {(!!error || error) && (
368
+ <NotFoundSource
369
+ btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
370
+ content={
371
+ props.order.error[0] ||
372
+ props.order.error ||
373
+ t('NETWORK_ERROR', 'Network Error')
374
+ }
375
+ onClickButton={() => navigation.navigate('Orders')}
376
+ />
377
+ )}
378
+
379
+ {order && Object.keys(order).length > 0 && (error?.length < 1 || !error) && (
380
+ <View style={{ flex: 1 }}>
381
+ <OrderHeaderComponent
382
+ order={order}
383
+ handleOpenMapView={handleOpenMapView}
384
+ handleOpenMessagesForBusiness={handleOpenMessagesForBusiness}
385
+ getOrderStatus={getOrderStatus}
386
+ handleArrowBack={handleArrowBack}
387
+ />
388
+ <OrderDetailsContainer
389
+ keyboardShouldPersistTaps="handled"
390
+ showsVerticalScrollIndicator={false}>
391
+ <>
392
+ <OrderContentComponent order={order} />
393
+ {(order?.status === 7 || order?.status === 4) &&
394
+ order?.delivery_type === 1 && (
395
+ <AssignDriver>
396
+ <OText style={{ marginBottom: 5 }} size={16} weight="600">
397
+ {t('ASSIGN_DRIVER', 'Assign driver')}
398
+ </OText>
399
+
400
+ <View
401
+ style={{
402
+ backgroundColor: theme.colors.inputChat,
403
+ borderRadius: 7.5,
404
+ }}>
405
+ <CountryPicker
406
+ // @ts-ignore
407
+ countryCode={undefined}
408
+ visible={isDriverModalVisible}
409
+ onClose={() => setIsDriverModalVisible(false)}
410
+ withCountryNameButton
411
+ renderFlagButton={() => (
412
+ <>
413
+ <TouchableOpacity
414
+ onPress={() => setIsDriverModalVisible(true)}
415
+ disabled={
416
+ itemsDrivers.length === 0 || loadingDriver
417
+ }>
418
+ {loadingDriver ? (
419
+ <DriverItem justifyContent="center">
420
+ <ActivityIndicator
421
+ size="small"
422
+ color={theme.colors.primary}
423
+ />
424
+ </DriverItem>
425
+ ) : (
426
+ <DriverItem justifyContent="space-between">
427
+ <OText>
428
+ {itemsDrivers.length > 0
429
+ ? order?.driver?.name ||
430
+ t('SELECT_DRIVER', 'Select Driver')
431
+ : t('WITHOUT_DRIVERS', 'Without drivers')}
432
+ </OText>
433
+ <OIcon
434
+ src={theme?.images?.general?.chevronDown}
435
+ color={theme.colors.backArrow}
436
+ width={20}
437
+ height={20}
438
+ />
439
+ </DriverItem>
440
+ )}
441
+ </TouchableOpacity>
442
+ </>
443
+ )}
444
+ flatListProps={{
445
+ keyExtractor: (item: any) => item.value,
446
+ data: itemsDrivers || [],
447
+ renderItem: ({ item }: any) => (
448
+ <TouchableOpacity
449
+ style={!item.available && styles.driverOff}
450
+ disabled={
451
+ !item.available ||
452
+ order?.driver?.id === item.value
453
+ }
454
+ onPress={() => {
455
+ handleAssignDriver &&
456
+ handleAssignDriver(item.value);
457
+ setIsDriverModalVisible(false);
458
+ }}>
459
+ <DriverItem>
460
+ <OText
461
+ color={!item.available && theme.colors.grey}>
462
+ {item.label}
463
+ {!item.available &&
464
+ ` (${t('NOT_AVAILABLE', 'Not available')})`}
465
+ {item.value === order?.driver?.id &&
466
+ ` (${t('SELECTED', 'Selected')})`}
467
+ </OText>
468
+ </DriverItem>
469
+ </TouchableOpacity>
470
+ ),
471
+ }}
472
+ />
473
+ </View>
474
+ </AssignDriver>
475
+ )}
476
+
477
+ {order?.status === 7 && (
478
+ <Pickup>
479
+ <OButton
480
+ style={styles.btnPickUp}
481
+ textStyle={{ color: theme.colors.primary }}
482
+ text={t('READY_FOR_PICKUP', 'Ready for pickup')}
483
+ onClick={() =>
484
+ handleChangeOrderStatus && handleChangeOrderStatus(4)
485
+ }
486
+ imgLeftStyle={{ tintColor: theme.colors.backArrow }}
487
+ imgRightSrc={false}
488
+ isLoading={loading}
489
+ />
490
+ </Pickup>
491
+ )}
492
+
493
+ {order?.status === 4 && ![1].includes(order?.delivery_type) && (
494
+ <Pickup>
495
+ <OButton
496
+ style={{
497
+ ...styles.btnPickUp,
498
+ backgroundColor: theme.colors.green,
499
+ }}
500
+ textStyle={{ color: theme.colors.white }}
501
+ text={t(
502
+ 'PICKUP_COMPLETED_BY_CUSTOMER',
503
+ 'Pickup completed by customer',
504
+ )}
505
+ onClick={() =>
506
+ handleChangeOrderStatus && handleChangeOrderStatus(15)
507
+ }
508
+ imgLeftStyle={{ tintColor: theme.colors.backArrow }}
509
+ imgRightSrc={false}
510
+ isLoading={loading}
511
+ />
512
+ </Pickup>
513
+ )}
514
+
515
+ {order?.status === 4 && ![1].includes(order?.delivery_type) && (
516
+ <Pickup>
517
+ <OButton
518
+ style={{
519
+ ...styles.btnPickUp,
520
+ backgroundColor: theme.colors.red,
521
+ }}
522
+ textStyle={{ color: theme.colors.white }}
523
+ text={t(
524
+ 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
525
+ 'Order not picked up by customer',
526
+ )}
527
+ onClick={() =>
528
+ handleChangeOrderStatus && handleChangeOrderStatus(17)
529
+ }
530
+ imgLeftStyle={{ tintColor: theme.colors.backArrow }}
531
+ imgRightSrc={false}
532
+ isLoading={loading}
533
+ />
534
+ </Pickup>
535
+ )}
536
+
537
+ <OModal
538
+ open={openModalForBusiness}
539
+ order={order}
540
+ title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order?.id}`}
541
+ entireModal
542
+ onClose={() => handleCloseModal()}>
543
+ <Chat
544
+ type={
545
+ openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
546
+ }
547
+ orderId={order?.id}
548
+ messages={messages}
549
+ order={order}
550
+ setMessages={setMessages}
551
+ />
552
+ </OModal>
553
+
554
+ <OModal
555
+ open={openModalForAccept}
556
+ onClose={() => setOpenModalForAccept(false)}
557
+ entireModal
558
+ customClose>
559
+ <AcceptOrRejectOrder
560
+ handleUpdateOrder={handleChangeOrderStatus}
561
+ closeModal={setOpenModalForAccept}
562
+ customerCellphone={order?.customer?.cellphone}
563
+ loading={loading}
564
+ action={actionOrder}
565
+ orderId={order?.id}
566
+ notShowCustomerPhone={false}
567
+ actions={actions}
568
+ titleAccept={titleAccept}
569
+ titleReject={titleReject}
570
+ appTitle={appTitle}
571
+ />
572
+ </OModal>
573
+
574
+ <OModal
575
+ open={openModalForMapView}
576
+ onClose={() => handleOpenMapView()}
577
+ entireModal
578
+ customClose>
579
+ <GoogleMap
580
+ location={order?.customer?.location}
581
+ locations={locationsToSend}
582
+ driverLocation={driverLocation}
583
+ navigation={navigation}
584
+ handleViewActionOrder={handleViewActionOrder}
585
+ handleOpenMapView={handleOpenMapView}
586
+ readOnly
587
+ showAcceptOrReject={
588
+ showFloatButtonsAcceptOrReject[order?.status]
589
+ }
590
+ />
591
+ </OModal>
592
+ </>
593
+ <View style={{ height: 30 }} />
594
+ </OrderDetailsContainer>
595
+
596
+ {order &&
597
+ Object.keys(order).length > 0 &&
598
+ getOrderStatus(order?.status, t)?.value ===
599
+ t('PENDING', 'Pending') && (
600
+ <FloatingButton
601
+ btnText={t('REJECT', 'Reject')}
602
+ isSecondaryBtn={false}
603
+ secondButtonClick={() => handleViewActionOrder('accept')}
604
+ firstButtonClick={() => handleViewActionOrder('reject')}
605
+ secondBtnText={t('ACCEPT', 'Accept')}
606
+ secondButton={true}
607
+ firstColorCustom={theme.colors.red}
608
+ secondColorCustom={theme.colors.green}
609
+ widthButton={'45%'}
610
+ />
611
+ )}
612
+
613
+ {order &&
614
+ Object.keys(order).length > 0 &&
615
+ getOrderStatus(order?.status, t)?.value !==
616
+ t('PENDING', 'Pending') && (
617
+ <FloatingButton
618
+ btnText={t('COPY', 'Copy')}
619
+ isSecondaryBtn={false}
620
+ colorTxt1={theme.colors.primary}
621
+ secondButtonClick={handleViewSummaryOrder}
622
+ firstButtonClick={handleCopyClipboard}
623
+ secondBtnText={t('PRINT', 'Print')}
624
+ secondButton={true}
625
+ firstColorCustom="transparent"
626
+ secondColorCustom={theme.colors.primary}
627
+ widthButton={'45%'}
628
+ />
629
+ )}
630
+ </View>
631
+ )}
632
+ </>
633
+ );
634
+ };
635
+
636
+ export const OrderDetailsBusiness = (props: OrderDetailsParams) => {
637
+ const orderDetailsProps = {
638
+ ...props,
639
+ UIComponent: OrderDetailsUI,
640
+ };
641
+ return <OrderDetailsController {...orderDetailsProps} />;
642
+ };