ordering-ui-react-native 0.12.51 → 0.12.52

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.51",
3
+ "version": "0.12.52",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,6 +1,6 @@
1
1
  //React & React Native
2
2
  import React, { useState, useEffect } from 'react';
3
- import { StyleSheet, View, Platform } from 'react-native';
3
+ import { StyleSheet, View, Platform, ScrollView } from 'react-native';
4
4
 
5
5
  // Thirds
6
6
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
@@ -50,9 +50,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
50
50
  setDriverUpdateLocation,
51
51
  orderTitle,
52
52
  appTitle,
53
- handleClickLogisticOrder
54
- } = props;
53
+ handleClickLogisticOrder,
55
54
 
55
+ } = props;
56
56
  const [, { showToast }] = useToast();
57
57
  const { order } = props.order
58
58
  const theme = useTheme();
@@ -141,6 +141,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
141
141
  handleArrowBack()
142
142
  }
143
143
 
144
+ const handleAcceptLogisticOrder = (order : any) => {
145
+ handleClickLogisticOrder?.(1, order?.logistic_order_id)
146
+ if(order?.order_group){
147
+ handleArrowBack()
148
+ }
149
+ }
150
+
144
151
  const locations = [
145
152
  {
146
153
  ...order?.business?.location,
@@ -243,107 +250,54 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
243
250
  );
244
251
  }
245
252
 
246
- const OrderDetailsInformation = (_order: any, isOrderGroup: boolean) => {
247
- const { order } = _order
253
+ const OrderDetailsInformation = (props : {order: any, isOrderGroup?: boolean, lastOrder?: boolean}) => {
254
+ const {
255
+ order,
256
+ isOrderGroup,
257
+ lastOrder,
258
+ } = props
248
259
  return (
249
260
  <>
250
- <OrderDetailsContainer
251
- keyboardShouldPersistTaps="handled"
252
- showsVerticalScrollIndicator={false}
253
- >
254
- <>
255
- <OrderContentComponent
256
- order={order}
257
- logisticOrderStatus={logisticOrderStatus}
258
- isOrderGroup={isOrderGroup}
261
+ <OrderContentComponent
262
+ order={order}
263
+ logisticOrderStatus={logisticOrderStatus}
264
+ isOrderGroup={isOrderGroup}
265
+ lastOrder={lastOrder}
266
+ />
267
+ {(order?.status === 8 || order?.status === 18) && order?.delivery_type === 1 && (
268
+ <Pickup>
269
+ <OButton
270
+ style={styles.btnPickUp}
271
+ textStyle={{ color: theme.colors.primary }}
272
+ text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
273
+ onClick={() =>
274
+ handleChangeOrderStatus && handleChangeOrderStatus(3)
275
+ }
276
+ imgLeftStyle={{ tintColor: theme.colors.backArrow }}
259
277
  />
260
- {(order?.status === 8 || order?.status === 18) && order?.delivery_type === 1 && (
261
- <Pickup>
262
- <OButton
263
- style={styles.btnPickUp}
264
- textStyle={{ color: theme.colors.primary }}
265
- text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
266
- onClick={() =>
267
- handleChangeOrderStatus && handleChangeOrderStatus(3)
268
- }
269
- imgLeftStyle={{ tintColor: theme.colors.backArrow }}
270
- />
271
- </Pickup>
272
- )}
273
- {order?.status === 3 && order?.delivery_type === 1 && (
274
- <View style={{ paddingVertical: 20, marginBottom: 20 }}>
275
- <OButton
276
- style={styles.btnPickUp}
277
- textStyle={{ color: theme.colors.white }}
278
- text={t('ORDER_NOT_READY', 'Order not ready')}
279
- onClick={() =>
280
- handleViewActionOrder && handleViewActionOrder('notReady')
281
- }
282
- imgLeftStyle={{ tintColor: theme.colors.backArrow }}
283
- bgColor={theme.colors.red}
284
- />
285
- </View>
286
- )}
287
- </>
288
- <View
289
- style={{
290
- height:
291
- order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
292
- }}
293
- />
294
- </OrderDetailsContainer>
295
-
296
- {showFloatButtonsPickUp[order?.status] && (
297
- <FloatingButton
298
- disabled={props.order?.loading}
299
- btnText={t('PICKUP_FAILED', 'Pickup failed')}
300
- isSecondaryBtn={false}
301
- secondButtonClick={() =>
302
- handleChangeOrderStatus && handleChangeOrderStatus(9)
303
- }
304
- firstButtonClick={() =>
305
- handleViewActionOrder && handleViewActionOrder('pickupFailed')
306
- }
307
- secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
308
- secondButton={true}
309
- firstColorCustom={theme.colors.red}
310
- secondColorCustom={theme.colors.green}
311
- widthButton={'45%'}
312
- />
278
+ </Pickup>
313
279
  )}
314
- {(order?.status === 9 || order?.status === 19) && (
315
- <>
316
- <FloatingButton
317
- disabled={props.order?.loading}
318
- btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
319
- isSecondaryBtn={false}
320
- secondButtonClick={() =>
321
- handleChangeOrderStatus && handleChangeOrderStatus(11)
280
+ {order?.status === 3 && order?.delivery_type === 1 && (
281
+ <View style={{ paddingVertical: 20, marginBottom: 20 }}>
282
+ <OButton
283
+ style={styles.btnPickUp}
284
+ textStyle={{ color: theme.colors.white }}
285
+ text={t('ORDER_NOT_READY', 'Order not ready')}
286
+ onClick={() =>
287
+ handleViewActionOrder && handleViewActionOrder('notReady')
322
288
  }
323
- firstButtonClick={() =>
324
- handleViewActionOrder && handleViewActionOrder('deliveryFailed')
325
- }
326
- secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
327
- secondButton={true}
328
- firstColorCustom={theme.colors.red}
329
- secondColorCustom={theme.colors.green}
330
- widthButton={'45%'}
289
+ imgLeftStyle={{ tintColor: theme.colors.backArrow }}
290
+ bgColor={theme.colors.red}
331
291
  />
332
- </>
333
- )}
334
- {showFloatButtonsAcceptOrReject[order?.status] && (
335
- <FloatingButton
336
- btnText={t('REJECT', 'Reject')}
337
- isSecondaryBtn={false}
338
- secondButtonClick={() => order?.isLogistic && logisticOrderStatus.includes(order?.status) ? handleClickLogisticOrder?.(1, order?.logistic_order_id) : handleViewActionOrder('accept')}
339
- firstButtonClick={() => order?.isLogistic && logisticOrderStatus.includes(order?.status) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
340
- secondBtnText={t('ACCEPT', 'Accept')}
341
- secondButton={true}
342
- firstColorCustom={theme.colors.red}
343
- secondColorCustom={theme.colors.green}
344
- widthButton={'45%'}
345
- />
292
+ </View>
346
293
  )}
294
+ <View
295
+ style={{
296
+ height:
297
+ order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
298
+ }}
299
+ />
300
+
347
301
  </>
348
302
  )
349
303
  }
@@ -390,10 +344,66 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
390
344
  />
391
345
  {order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
392
346
  <>
393
- {order?.order_group && order?.order_group_id ? order?.order_group?.orders.map((order: any) => (
394
- <OrderDetailsInformation order={order} />
395
- )) : (
396
- <OrderDetailsInformation order={order} />
347
+ <OrderDetailsContainer
348
+ keyboardShouldPersistTaps="handled"
349
+ showsVerticalScrollIndicator={false}
350
+ >
351
+ {order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
352
+ <OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
353
+ )) : (
354
+ <OrderDetailsInformation order={order} />
355
+ )}
356
+ </OrderDetailsContainer>
357
+ {showFloatButtonsPickUp[order?.status] && (
358
+ <FloatingButton
359
+ disabled={props.order?.loading}
360
+ btnText={t('PICKUP_FAILED', 'Pickup failed')}
361
+ isSecondaryBtn={false}
362
+ secondButtonClick={() =>
363
+ handleChangeOrderStatus && handleChangeOrderStatus(9)
364
+ }
365
+ firstButtonClick={() =>
366
+ handleViewActionOrder && handleViewActionOrder('pickupFailed')
367
+ }
368
+ secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
369
+ secondButton={true}
370
+ firstColorCustom={theme.colors.red}
371
+ secondColorCustom={theme.colors.green}
372
+ widthButton={'45%'}
373
+ />
374
+ )}
375
+ {(order?.status === 9 || order?.status === 19) && (
376
+ <>
377
+ <FloatingButton
378
+ disabled={props.order?.loading}
379
+ btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
380
+ isSecondaryBtn={false}
381
+ secondButtonClick={() =>
382
+ handleChangeOrderStatus && handleChangeOrderStatus(11)
383
+ }
384
+ firstButtonClick={() =>
385
+ handleViewActionOrder && handleViewActionOrder('deliveryFailed')
386
+ }
387
+ secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
388
+ secondButton={true}
389
+ firstColorCustom={theme.colors.red}
390
+ secondColorCustom={theme.colors.green}
391
+ widthButton={'45%'}
392
+ />
393
+ </>
394
+ )}
395
+ {showFloatButtonsAcceptOrReject[order?.status] && (
396
+ <FloatingButton
397
+ btnText={t('REJECT', 'Reject')}
398
+ isSecondaryBtn={false}
399
+ secondButtonClick={() => (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
400
+ firstButtonClick={() => order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status)) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
401
+ secondBtnText={t('ACCEPT', 'Accept')}
402
+ secondButton={true}
403
+ firstColorCustom={theme.colors.red}
404
+ secondColorCustom={theme.colors.green}
405
+ widthButton={'45%'}
406
+ />
397
407
  )}
398
408
  </>
399
409
  )}
@@ -27,14 +27,16 @@ import { ReviewCustomer } from '../ReviewCustomer'
27
27
 
28
28
  interface OrderContent {
29
29
  order: any,
30
- logisticOrderStatus?: Array<number>
30
+ logisticOrderStatus?: Array<number>,
31
+ isOrderGroup?: boolean,
32
+ lastOrder?: boolean
31
33
  }
32
34
 
33
35
  export const OrderContentComponent = (props: OrderContent) => {
34
36
  const [, t] = useLanguage();
35
37
  const theme = useTheme()
36
38
 
37
- const { order, logisticOrderStatus } = props;
39
+ const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
38
40
  const [{ parsePrice, parseNumber }] = useUtils();
39
41
  const [{ configs }] = useConfig();
40
42
  const [openReviewModal, setOpenReviewModal] = useState(false)
@@ -69,7 +71,10 @@ export const OrderContentComponent = (props: OrderContent) => {
69
71
  }
70
72
 
71
73
  return (
72
- <OrderContent>
74
+ <OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
75
+ {isOrderGroup && (
76
+ <OText size={18}>{t('ORDER', 'Order')} #{isOrderGroup ? order?.order_group_id : order?.id}</OText>
77
+ )}
73
78
  <OrderBusiness>
74
79
  <OText style={{ marginBottom: 5 }} size={16} weight="600">
75
80
  {t('BUSINESS_DETAILS', 'Business details')}
@@ -148,42 +153,52 @@ export const OrderContentComponent = (props: OrderContent) => {
148
153
  <OText style={{ marginBottom: 5 }} size={16} weight="600">
149
154
  {t('CUSTOMER_DETAILS', 'Customer details')}
150
155
  </OText>
151
-
152
- <View style={{ flexDirection: 'row' }}>
153
- <OText numberOfLines={2} mBottom={4}>
154
- <OText
155
- numberOfLines={1}
156
- mBottom={4}
157
- ellipsizeMode="tail"
158
- space>
159
- {order?.customer?.name}
160
- </OText>
161
-
162
- <OText
163
- numberOfLines={1}
164
- mBottom={4}
165
- ellipsizeMode="tail"
166
- space>
167
- {order?.customer?.middle_name}
168
- </OText>
169
-
170
- <OText
171
- numberOfLines={1}
172
- mBottom={4}
173
- ellipsizeMode="tail"
174
- space>
175
- {order?.customer?.lastname}
176
- </OText>
177
-
178
- <OText
179
- numberOfLines={1}
180
- mBottom={4}
181
- ellipsizeMode="tail"
182
- space>
183
- {order?.customer?.second_lastname}
184
- </OText>
185
- </OText>
186
- </View>
156
+ {
157
+ (order?.customer?.name || order?.customer?.lastname) && (
158
+ <View style={{ flexDirection: 'row' }}>
159
+ <OText numberOfLines={2} mBottom={4}>
160
+ {order?.customer?.name && (
161
+ <OText
162
+ numberOfLines={1}
163
+ mBottom={4}
164
+ ellipsizeMode="tail"
165
+ space>
166
+ {order?.customer?.name}
167
+ </OText>
168
+ )}
169
+ {order?.customer?.middle_name && (
170
+ <OText
171
+ numberOfLines={1}
172
+ mBottom={4}
173
+ ellipsizeMode="tail"
174
+ space>
175
+ {order?.customer?.middle_name}
176
+ </OText>
177
+ )}
178
+ {order?.customer?.lastname && (
179
+ <OText
180
+ numberOfLines={1}
181
+ mBottom={4}
182
+ ellipsizeMode="tail"
183
+ space>
184
+ {order?.customer?.lastname}
185
+ </OText>
186
+ )}
187
+ {
188
+ order?.customer?.second_lastname && (
189
+ <OText
190
+ numberOfLines={1}
191
+ mBottom={4}
192
+ ellipsizeMode="tail"
193
+ space>
194
+ {order?.customer?.second_lastname}
195
+ </OText>
196
+ )
197
+ }
198
+ </OText>
199
+ </View>
200
+ )
201
+ }
187
202
 
188
203
  {!!order?.customer?.email && (
189
204
  <View style={styles.linkWithIcons}>
@@ -28,8 +28,8 @@ interface OrderHeader {
28
28
  handleOpenMessagesForBusiness?: any,
29
29
  getOrderStatus?: any,
30
30
  logisticOrderStatus?: Array<number>,
31
- handleViewSummaryOrder: any;
32
- handleCopyClipboard: any
31
+ handleViewSummaryOrder?: any;
32
+ handleCopyClipboard?: any
33
33
  }
34
34
 
35
35
  export const OrderHeaderComponent = (props: OrderHeader) => {
@@ -96,7 +96,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
96
96
  />
97
97
 
98
98
  {
99
- (!order?.isLogistic || !logisticOrderStatus?.includes(order?.status)) && (
99
+ (!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
100
100
  <Actions>
101
101
  {getOrderStatus(order?.status, t)?.value !==
102
102
  t('PENDING', 'Pending') && (
@@ -111,7 +111,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
111
111
  }}
112
112
  borderColor={theme.colors.clear}
113
113
  style={styles.icons}
114
- onClick={() => handleCopyClipboard()}
114
+ onClick={() => handleCopyClipboard?.()}
115
115
  />
116
116
  <OIconButton
117
117
  icon={theme.images.general.print}
@@ -122,7 +122,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
122
122
  }}
123
123
  borderColor={theme.colors.clear}
124
124
  style={styles.icons}
125
- onClick={() => handleViewSummaryOrder()}
125
+ onClick={() => handleViewSummaryOrder?.()}
126
126
  />
127
127
  </>
128
128
  )}
@@ -162,7 +162,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
162
162
  <OText numberOfLines={2} size={20} weight="600">
163
163
  <>
164
164
  {`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id} `}
165
- {(!order?.isLogistic || !logisticOrderStatus?.includes(order?.status)) && (
165
+ {!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
166
166
  <>
167
167
  {t('IS', 'is')}{' '}
168
168
  <OText
@@ -175,7 +175,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
175
175
  )}
176
176
  </>
177
177
  </OText>
178
- {(!order?.isLogistic || !logisticOrderStatus?.includes(order?.status)) && (
178
+ {!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
179
179
  <OText size={13}>
180
180
  {`${order?.paymethod?.name} - ${order.delivery_type === 1
181
181
  ? t('DELIVERY', 'Delivery')
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components/native';
1
+ import styled, { css } from 'styled-components/native';
2
2
 
3
3
  export const OrderDetailsContainer = styled.ScrollView`
4
4
  flex: 1;
@@ -25,6 +25,15 @@ export const Logo = styled.View`
25
25
 
26
26
  export const OrderContent = styled.View`
27
27
  flex: 1;
28
+ ${(props : any) => props.isOrderGroup && css`
29
+ border-color: rgba(0, 0, 0, 0.2);
30
+ border-width: 1px;
31
+ padding: 10px;
32
+ `
33
+ }
34
+ ${(props : any) => props.lastOrder && css`
35
+ margin-bottom: 50px;
36
+ `}
28
37
  `;
29
38
 
30
39
  export const OrderHeader = styled.View`
@@ -45,7 +54,7 @@ export const OrderBusiness = styled.View`
45
54
  export const OrderCustomer = styled.View`
46
55
  border-bottom-width: 10px;
47
56
  border-bottom-color: ${(props: any) => props.theme.colors.inputChat};
48
- padding-vertical: 20px;
57
+ padding-vertical: 10px;
49
58
  `;
50
59
 
51
60
  export const OrderProducts = styled(OrderCustomer)``;
@@ -187,7 +187,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
187
187
  };
188
188
 
189
189
  const getOrderStatus = (key: number) => {
190
- return orderStatus.find((status: any) => status.key === key)?.text;
190
+ return orderStatus.find((status: any) => status?.key === key)?.text;
191
191
  };
192
192
 
193
193
  const applyFilters = () => {
@@ -454,7 +454,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
454
454
  currentTabSelected !== 'logisticOrders' &&
455
455
  (
456
456
  <PreviousOrders
457
- orders={currentOrdersGroup.orders}
457
+ orders={currentOrdersGroup?.orders}
458
458
  onNavigationRedirect={onNavigationRedirect}
459
459
  getOrderStatus={getOrderStatus}
460
460
  handleClickOrder={handleClickOrder}
@@ -464,7 +464,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
464
464
  logisticOrders?.orders?.length > 0 &&
465
465
  currentTabSelected === 'logisticOrders' && (
466
466
  <PreviousOrders
467
- orders={logisticOrders.orders.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
467
+ orders={logisticOrders?.orders?.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
468
468
  onNavigationRedirect={onNavigationRedirect}
469
469
  getOrderStatus={getOrderStatus}
470
470
  handleClickLogisticOrder={handleClickLogisticOrder}
@@ -528,13 +528,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
528
528
  (currentOrdersGroup?.error?.length ||
529
529
  currentOrdersGroup?.orders?.length === 0)) ||
530
530
  (currentTabSelected === 'logisticOrders' &&
531
- (logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0))
531
+ (logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired)))
532
532
  ) &&
533
533
  (
534
534
  <NotFoundSource
535
535
  content={
536
536
  ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
537
- (currentTabSelected === 'logisticOrders' && !logisticOrders?.error?.length))
537
+ (currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
538
538
  ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
539
539
  : currentOrdersGroup?.error?.[0]?.message ||
540
540
  currentOrdersGroup?.error?.[0] ||
@@ -85,9 +85,9 @@ export const PreviousOrders = (props: any) => {
85
85
  <>
86
86
  {orders && orders?.length > 0 &&
87
87
  orders
88
- .filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
89
- .map((_order: any) => {
90
- const order = _order?.isLogistic && !_order?.order_group ? _order?.order : _order
88
+ ?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
89
+ ?.map((_order: any) => {
90
+ const order = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
91
91
  return (
92
92
  <View
93
93
  style={{
@@ -116,9 +116,9 @@ export const PreviousOrders = (props: any) => {
116
116
  </Logo>
117
117
  )}
118
118
  <Information>
119
- {order?.order_group && order?.order_group_id && (
119
+ {order?.order_group_id && (
120
120
  <OText>
121
- <OText>{order?.order_group?.orders?.length} {t('ORDERS', 'Orders')}</OText>
121
+ <OText>{(t('INVOICE_GROUP_NO', 'Group No.') + order?.order_group_id)}</OText>
122
122
  </OText>
123
123
  )}
124
124
  {order.business?.name && (
@@ -140,7 +140,7 @@ export const PreviousOrders = (props: any) => {
140
140
  numberOfLines={1}
141
141
  adjustsFontSizeToFit
142
142
  size={20}>
143
- {(order?.order_group && order?.order_group_id ? (t('INVOICE_GROUP_NO', 'Group No.') + order?.order_group_id) : (t('INVOICE_ORDER_NO', 'Order No.') + order.id)) + ' · '}
143
+ {(order?.order_group_id && order?.order_group && isLogisticOrder ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}` : (t('INVOICE_ORDER_NO', 'Order No.') + order.id)) + ' · '}
144
144
  {order?.delivery_datetime_utc
145
145
  ? parseDate(order?.delivery_datetime_utc)
146
146
  : parseDate(order?.delivery_datetime, { utc: false })}
@@ -171,26 +171,41 @@ export const PreviousOrders = (props: any) => {
171
171
  </TouchableOpacity>
172
172
  {isLogisticOrder && (
173
173
  <AcceptOrRejectOrder>
174
- <OButton
175
- text={t('REJECT', 'Reject')}
176
- onClick={() => handleClickLogisticOrder(2, _order?.id)}
177
- bgColor={theme.colors.danger}
178
- borderColor={theme.colors.danger}
179
- imgRightSrc={null}
180
- style={{ borderRadius: 7, height: 40 }}
181
- parentStyle={{ width: '45%' }}
182
- textStyle={{ color: theme.colors.dangerText }}
183
- />
184
- <OButton
185
- text={t('ACCEPT', 'Accept')}
186
- onClick={() => handleClickLogisticOrder(1, _order?.id)}
187
- bgColor={theme.colors.successOrder}
188
- borderColor={theme.colors.successOrder}
189
- imgRightSrc={null}
190
- style={{ borderRadius: 7, height: 40 }}
191
- parentStyle={{ width: '45%' }}
192
- textStyle={{ color: theme.colors.successText }}
193
- />
174
+ {order?.order_group_id && order?.order_group ? (
175
+ <OButton
176
+ text={t('VIEW_ORDER', 'View order')}
177
+ onClick={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
178
+ bgColor={theme.colors.blueLight}
179
+ borderColor={theme.colors.blueLight}
180
+ imgRightSrc={null}
181
+ style={{ borderRadius: 7, height: 40 }}
182
+ parentStyle={{ width: '100%' }}
183
+ textStyle={{ color: theme.colors.primary }}
184
+ />
185
+ ) : (
186
+ <>
187
+ <OButton
188
+ text={t('REJECT', 'Reject')}
189
+ onClick={() => handleClickLogisticOrder(2, _order?.id)}
190
+ bgColor={theme.colors.danger}
191
+ borderColor={theme.colors.danger}
192
+ imgRightSrc={null}
193
+ style={{ borderRadius: 7, height: 40 }}
194
+ parentStyle={{ width: '45%' }}
195
+ textStyle={{ color: theme.colors.dangerText }}
196
+ />
197
+ <OButton
198
+ text={t('ACCEPT', 'Accept')}
199
+ onClick={() => handleClickLogisticOrder(1, _order?.id)}
200
+ bgColor={theme.colors.successOrder}
201
+ borderColor={theme.colors.successOrder}
202
+ imgRightSrc={null}
203
+ style={{ borderRadius: 7, height: 40 }}
204
+ parentStyle={{ width: '45%' }}
205
+ textStyle={{ color: theme.colors.successText }}
206
+ />
207
+ </>
208
+ )}
194
209
  </AcceptOrRejectOrder>
195
210
  )}
196
211
  </View>