ordering-ui-react-native 0.17.67 → 0.17.68

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.
@@ -1,21 +1,21 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { StyleSheet, TouchableOpacity, View, Platform, PlatformIOSStatic } from 'react-native';
2
+ import { View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
- import moment from 'moment'
5
- import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
6
- import { OButton, OIcon, OText } from '../shared';
7
- import {
8
- Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder, Timestatus
9
- } from './styles';
10
- import EntypoIcon from 'react-native-vector-icons/Entypo'
11
- import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
12
- import DeviceInfo from 'react-native-device-info';
4
+ import { useLanguage } from 'ordering-components/native';
13
5
 
14
- const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
6
+ import {AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
7
+
8
+ import { OButton, OModal } from '../shared';
9
+ import { OrderItem } from './OrderItem'
10
+ import { OrdersGroupedItem } from './OrdersGroupedItem'
11
+ import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
12
+ import { ReviewCustomer } from '../ReviewCustomer';
13
+ import { GoogleMap } from '../GoogleMap';
15
14
 
16
15
  export const PreviousOrders = (props: any) => {
17
16
  const {
18
17
  orders,
18
+ ordersGrouped,
19
19
  onNavigationRedirect,
20
20
  getOrderStatus,
21
21
  handleClickOrder,
@@ -23,25 +23,23 @@ export const PreviousOrders = (props: any) => {
23
23
  handleClickLogisticOrder,
24
24
  slaSettingTime,
25
25
  currentTabSelected,
26
- currentOrdenSelected
26
+ currentOrdenSelected,
27
+ handleChangeOrderStatus,
28
+ handleSendCustomerReview
27
29
  } = props;
30
+
31
+ let hash: any = {};
28
32
  const [, t] = useLanguage();
29
- const [{ parseDate, optimizeImage }] = useUtils();
30
- const [configState] = useConfig()
31
33
  const theme = useTheme();
32
- const [, setCurrentTime] = useState()
33
- const [allowColumns, setAllowColumns] = useState({
34
- timer: configState?.configs?.order_deadlines_enabled?.value === '1',
35
- slaBar: configState?.configs?.order_deadlines_enabled?.value === '1',
36
- })
37
34
 
38
- const [orientationState] = useDeviceOrientation();
39
-
40
- const IS_PORTRAIT = orientationState.orientation === PORTRAIT
35
+ const [, setCurrentTime] = useState()
36
+ const [openModal, setOpenModal] = useState(false)
37
+ const [openReviewModal, setOpenReviewModal] = useState({ order: null, ids: [], customerId: null })
38
+ const [openMapViewModal, setOpenMapViewModal] = useState<any>({ open: false, customerLocation: null, locations: [] })
39
+ const [orderUpdateStatus, setOrderUpdateStatus] = useState<any>({ action: '', ids: [], body: {}, order: {} })
41
40
 
42
- const platformIOS = Platform as PlatformIOSStatic
43
- const isIpad = platformIOS.isPad
44
- const isTablet = DeviceInfo.isTablet();
41
+ const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
42
+ const viewMapStatus = [9, 18, 19, 23]
45
43
 
46
44
  const handlePressOrder = (order: any) => {
47
45
  if (order?.locked && isLogisticOrder) return
@@ -54,85 +52,126 @@ export const PreviousOrders = (props: any) => {
54
52
  }
55
53
  };
56
54
 
57
- const styles = StyleSheet.create({
58
- cardButton: {
59
- flex: 1,
60
- paddingVertical: (isIpad || isTablet) ? 20 : 0,
61
- marginBottom: IS_PORTRAIT ? 25 : 0,
62
- marginLeft: 3,
63
- },
64
- icon: {
65
- borderRadius: 7.6,
66
- width: 60,
67
- height: 60
68
- },
69
- logo: {
70
- borderRadius: 10,
71
- shadowColor: "#0000006e",
72
- shadowRadius: 10,
73
- elevation: 15,
74
- justifyContent: 'center',
75
- alignItems: 'center',
76
- marginLeft: 3,
77
- },
78
- title: {
79
- marginBottom: 6,
80
- fontFamily: 'Poppins',
81
- fontStyle: 'normal',
82
- fontWeight: '600',
83
- fontSize: 16,
84
- color: theme.colors.textGray,
85
- },
86
- date: {
87
- marginBottom: 6,
88
- fontFamily: 'Poppins',
89
- fontStyle: 'normal',
90
- fontWeight: 'normal',
91
- fontSize: 12,
92
- },
93
- orderType: {
94
- fontSize: 12,
95
- fontFamily: 'Poppins',
96
- fontStyle: 'normal',
97
- fontWeight: 'normal',
98
- color: theme.colors.orderTypeColor,
99
- },
100
- });
55
+ const OrdersList = (props: any) => {
56
+ const { order, _order, hideBtns } = props
57
+ return (
58
+ <View
59
+ style={{
60
+ backgroundColor: currentOrdenSelected === order?.id ? theme.colors.gray100 : order?.locked && isLogisticOrder ? '#ccc' : '#fff',
61
+ marginBottom: isLogisticOrder ? 10 : 0
62
+ }}
63
+ >
64
+ <OrderItem
65
+ order={order}
66
+ _order={_order}
67
+ isLogisticOrder={isLogisticOrder}
68
+ handlePressOrder={handlePressOrder}
69
+ currentTabSelected={currentTabSelected}
70
+ getOrderStatus={getOrderStatus}
71
+ />
72
+ {isLogisticOrder && !hideBtns && (
73
+ <AcceptOrRejectOrderStyle>
74
+ {!!order?.order_group_id && !!order?.order_group ? (
75
+ <OButton
76
+ text={t('VIEW_ORDER', 'View order')}
77
+ onClick={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
78
+ bgColor={theme.colors.blueLight}
79
+ borderColor={theme.colors.blueLight}
80
+ imgRightSrc={null}
81
+ style={{ borderRadius: 7, height: 40 }}
82
+ parentStyle={{ width: '100%' }}
83
+ textStyle={{ color: theme.colors.primary }}
84
+ />
85
+ ) : (
86
+ <>
87
+ <OButton
88
+ text={t('REJECT', 'Reject')}
89
+ onClick={() => handleClickLogisticOrder(2, _order?.id)}
90
+ bgColor={theme.colors.danger}
91
+ borderColor={theme.colors.danger}
92
+ imgRightSrc={null}
93
+ style={{ borderRadius: 7, height: 40 }}
94
+ parentStyle={{ width: '45%' }}
95
+ textStyle={{ color: theme.colors.dangerText }}
96
+ />
97
+ <OButton
98
+ text={t('ACCEPT', 'Accept')}
99
+ onClick={() => handleClickLogisticOrder(1, _order?.id)}
100
+ bgColor={theme.colors.successOrder}
101
+ borderColor={theme.colors.successOrder}
102
+ imgRightSrc={null}
103
+ style={{ borderRadius: 7, height: 40 }}
104
+ parentStyle={{ width: '45%' }}
105
+ textStyle={{ color: theme.colors.successText }}
106
+ />
107
+ </>
108
+ )}
109
+ </AcceptOrRejectOrderStyle>
110
+ )}
111
+ </View>
112
+ )
113
+ }
101
114
 
102
- const getDelayMinutes = (order: any) => {
103
- // targetMin = delivery_datetime + eta_time - now()
104
- const offset = 300
105
- const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
106
- const _delivery = order?.delivery_datetime_utc
107
- ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
108
- : parseDate(cdtToutc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
109
- const _eta = order?.eta_time
110
- const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
111
- return Math.ceil(diffTimeAsSeconds / 60)
115
+ const ordersGroupAction = (param1 = '', param2 = '', { order, action, body, ids }: any = {}) => {
116
+ setOrderUpdateStatus({ ...orderUpdateStatus, action, ids, body, order })
117
+ if (!param1) setOpenModal(true)
118
+ if (param1) {
119
+ setOpenModal(false)
120
+ handleChangeOrderStatus &&
121
+ handleChangeOrderStatus(param1, orderUpdateStatus.ids, param2)
122
+ }
112
123
  }
113
124
 
114
- const displayDelayedTime = (order: any) => {
115
- let tagetedMin = getDelayMinutes(order)
116
- // get day, hour and minutes
117
- const sign = tagetedMin >= 0 ? '' : '- '
118
- tagetedMin = Math.abs(tagetedMin)
119
- let day: string | number = Math.floor(tagetedMin / 1440)
120
- const restMinOfTargetedMin = tagetedMin - 1440 * day
121
- let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
122
- let restMins: string | number = restMinOfTargetedMin - 60 * restHours
123
- // make standard time format
124
- day = day === 0 ? '' : day + 'day '
125
- restHours = restHours < 10 ? '0' + restHours : restHours
126
- restMins = restMins < 10 ? '0' + restMins : restMins
125
+ const handleOpenMapView = ({ orders }: any) => {
126
+ const locations: any = []
127
127
 
128
- const finalTaget = sign + day + restHours + ':' + restMins
129
- return finalTaget
130
- }
128
+ orders.map((_order: any) => {
129
+ if (_order?.driver?.location) {
130
+ locations.push({
131
+ ..._order?.driver?.location,
132
+ title: _order?.driver?.name ?? t('DRIVER', 'Driver'),
133
+ icon:
134
+ _order?.driver?.photo ||
135
+ 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png',
136
+ level: 4,
137
+ })
138
+ }
139
+ if (_order?.business?.location) {
140
+ locations.push({
141
+ ..._order?.business?.location,
142
+ title: _order?.business?.name,
143
+ address: {
144
+ addressName: _order?.business?.address,
145
+ zipcode: _order?.business?.zipcode
146
+ },
147
+ icon:
148
+ _order?.business?.logo ||
149
+ 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://res.cloudinary.com/ordering2/image/upload/v1654619525/hzegwosnplvrbtjkpfi6.png',
150
+ level: 2,
151
+ })
152
+ }
153
+ if (_order?.customer?.location) {
154
+ locations.push({
155
+ ..._order?.customer?.location,
156
+ title: _order?.customer?.name ?? t('CUSTOMER', 'Customer'),
157
+ address: {
158
+ addressName: _order?.customer?.address,
159
+ zipcode: _order?.customer?.zipcode
160
+ },
161
+ icon:
162
+ _order?.customer?.photo ||
163
+ 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
164
+ level: 3,
165
+ })
166
+ }
167
+ })
131
168
 
132
- const getStatusClassName = (minutes: number) => {
133
- if (isNaN(Number(minutes))) return 'in_time'
134
- const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
135
- return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
169
+ setOpenMapViewModal({
170
+ ...openMapViewModal,
171
+ open: true,
172
+ locations,
173
+ customerLocation: orders[0]?.customer?.location
174
+ })
136
175
  }
137
176
 
138
177
  useEffect(() => {
@@ -144,159 +183,210 @@ export const PreviousOrders = (props: any) => {
144
183
  return () => clearInterval(interval)
145
184
  }, [])
146
185
 
147
- useEffect(() => {
148
- const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
149
- setAllowColumns({
150
- ...allowColumns,
151
- timer: slaSettings,
152
- slaBar: slaSettings
153
- })
154
- }, [configState.loading])
155
-
156
- let hash: any = {};
157
186
 
158
187
  return (
159
188
  <>
160
- {orders && orders?.length > 0 &&
189
+ {Object.keys(ordersGrouped)?.length > 0 && (
190
+ <View style={{ marginBottom: 10 }}>
191
+ {Object.keys(ordersGrouped).map(k => (
192
+ <OrdersGroupedItem
193
+ key={k}
194
+ groupId={k}
195
+ orders={ordersGrouped[k]}
196
+ >
197
+ {ordersGrouped[k]?.length > 0 &&
198
+ ordersGrouped[k]
199
+ ?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
200
+ ?.map((_order: any) => {
201
+ const order = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
202
+ return (
203
+ <OrdersList key={order.id} order={order} _order={_order} hideBtns />
204
+ )
205
+ }
206
+ )
207
+ }
208
+ {ordersGrouped[k][0]?.status === 0 && (
209
+ <AcceptOrRejectOrderStyle>
210
+ <OButton
211
+ text={t('REJECT_ALL', 'Reject all')}
212
+ bgColor={theme.colors.danger100}
213
+ borderColor={theme.colors.danger100}
214
+ imgRightSrc={null}
215
+ style={{ borderRadius: 7, height: 40 }}
216
+ parentStyle={{ width: '45%' }}
217
+ textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
218
+ onClick={() => ordersGroupAction('', '', {
219
+ action: 'reject',
220
+ order: ordersGrouped[k][0],
221
+ ids: ordersGrouped[k].map((o: any) => o.id)
222
+ })}
223
+ />
224
+ <OButton
225
+ text={t('ACCEPT_ALL', 'Accept all')}
226
+ bgColor={theme.colors.success100}
227
+ borderColor={theme.colors.success100}
228
+ imgRightSrc={null}
229
+ style={{ borderRadius: 7, height: 40 }}
230
+ parentStyle={{ width: '45%' }}
231
+ textStyle={{ color: theme.colors.success500, fontSize: 12 }}
232
+ onClick={() => ordersGroupAction('', '', {
233
+ action: 'accept',
234
+ order: ordersGrouped[k][0],
235
+ ids: ordersGrouped[k].map((o: any) => o.id)
236
+ })}
237
+ />
238
+ </AcceptOrRejectOrderStyle>
239
+ )}
240
+ <View>
241
+ {ordersGrouped[k][0]?.status === 7 && (
242
+ <OButton
243
+ text={t('READY_FOR_PICKUP', 'Ready for pickup')}
244
+ bgColor={theme.colors.primaryLight}
245
+ borderColor={theme.colors.primaryLight}
246
+ imgRightSrc={null}
247
+ style={{ borderRadius: 7, height: 40 }}
248
+ parentStyle={{ width: '100%' }}
249
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
250
+ onClick={() => handleChangeOrderStatus(
251
+ 4,
252
+ ordersGrouped[k].map((o: any) => o.id),
253
+ )}
254
+ />
255
+ )}
256
+ </View>
257
+ <View>
258
+ {viewMapStatus.includes(ordersGrouped[k][0]?.status) && (
259
+ <OButton
260
+ text={t('TRACK_REAL_TIME_POSITION', 'Track real time position')}
261
+ bgColor={theme.colors.primaryLight}
262
+ borderColor={theme.colors.primaryLight}
263
+ imgRightSrc={null}
264
+ style={{ borderRadius: 7, height: 40 }}
265
+ parentStyle={{ width: '100%' }}
266
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
267
+ onClick={() => handleOpenMapView({ orders: ordersGrouped[k] })}
268
+ />
269
+ )}
270
+ </View>
271
+ {ordersGrouped[k][0]?.status === 4 &&
272
+ ![1].includes(ordersGrouped[k][0]?.delivery_type) &&
273
+ (
274
+ <AcceptOrRejectOrderStyle>
275
+ <OButton
276
+ text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
277
+ bgColor={theme.colors.danger100}
278
+ borderColor={theme.colors.danger100}
279
+ imgRightSrc={null}
280
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
281
+ parentStyle={{ width: '45%' }}
282
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
283
+ onClick={() => handleChangeOrderStatus(
284
+ 17,
285
+ ordersGrouped[k].map((o: any) => o.id),
286
+ )}
287
+ />
288
+ <OButton
289
+ text={t('PICKUP_COMPLETED_BY_CUSTOMER', 'Pickup completed by customer')}
290
+ bgColor={theme.colors.success100}
291
+ borderColor={theme.colors.success100}
292
+ imgRightSrc={null}
293
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
294
+ parentStyle={{ width: '45%' }}
295
+ textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
296
+ onClick={() => handleChangeOrderStatus(
297
+ 15,
298
+ ordersGrouped[k].map((o: any) => o.id),
299
+ )}
300
+ />
301
+ </AcceptOrRejectOrderStyle>
302
+ )}
303
+ {!ordersGrouped[k][0]?.user_review &&
304
+ pastOrderStatuses.includes(ordersGrouped[k][0]?.status) &&
305
+ (
306
+ <OButton
307
+ text={t('REVIEW_CUSTOMER', 'Review customer')}
308
+ bgColor={theme.colors.primary}
309
+ borderColor={theme.colors.primary}
310
+ imgRightSrc={null}
311
+ style={{ borderRadius: 8, height: 40 }}
312
+ parentStyle={{ width: '100%' }}
313
+ textStyle={{ color: theme.colors.white }}
314
+ onClick={() => setOpenReviewModal({
315
+ order: ordersGrouped[k][0],
316
+ customerId: ordersGrouped[k][0]?.customer_id,
317
+ ids: ordersGrouped[k].map((o: any) => o.id)
318
+ })}
319
+ />
320
+ )}
321
+ </OrdersGroupedItem>
322
+ ))}
323
+ </View>
324
+ )}
325
+ {orders?.length > 0 &&
161
326
  orders
162
327
  ?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
163
328
  ?.map((_order: any) => {
164
329
  const order = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
165
330
  return (
166
- <View
167
- style={{
168
- backgroundColor: currentOrdenSelected === order?.id ? theme.colors.gray100 : order?.locked && isLogisticOrder ? '#ccc' : '#fff',
169
- marginBottom: isLogisticOrder ? 10 : 0,
170
- // justifyContent: 'center'
171
- }}
172
- key={order.id}
173
- >
174
- <TouchableOpacity
175
- onPress={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
176
- style={styles.cardButton}
177
- disabled={order?.locked && isLogisticOrder}
178
- activeOpacity={1}
179
- >
180
- <Card key={order.id}>
181
- {allowColumns?.slaBar && (
182
- <Timestatus style={{ backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : '' }} />
183
- )}
184
- <Logo style={styles.logo}>
185
- <OIcon
186
- url={optimizeImage(
187
- order.business?.logo,
188
- 'h_300,c_limit',
189
- )}
190
- src={!order?.business?.logo && theme?.images?.dummies?.businessLogo}
191
- style={styles.icon}
192
- />
193
- </Logo>
194
- <Information>
195
- {!!order?.order_group_id && (
196
- <OText>
197
- <OText>{(t('INVOICE_GROUP_NO', 'Group No.') + order?.order_group_id)}</OText>
198
- </OText>
199
- )}
200
- {!!order.business?.name && (
201
- <OText numberOfLines={1} style={styles.title}>
202
- {order.business?.name}
203
- </OText>
204
- )}
205
- {!!order?.showNotification && (
206
- <NotificationIcon>
207
- <EntypoIcon
208
- name="dot-single"
209
- size={32}
210
- color={theme.colors.primary}
211
- />
212
- </NotificationIcon>
213
- )}
214
- <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
215
- <OText
216
- style={styles.date}
217
- color={theme.colors.unselectText}
218
- numberOfLines={1}
219
- adjustsFontSizeToFit
220
- >
221
- {(order?.order_group_id && order?.order_group && isLogisticOrder ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}` : (t('NO', 'Order No.') + order.id)) + ' · '}
222
- {order?.delivery_datetime_utc
223
- ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
224
- : parseDate(order?.delivery_datetime, { utc: false })}
225
- </OText>
226
- {((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
227
- <>
228
- <OText> · </OText>
229
- <OText style={styles.date} color={getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : ''} >{displayDelayedTime(order)}</OText>
230
- </>
231
- )}
232
- </View>
233
- {!isLogisticOrder && (
234
- <MyOrderOptions>
235
- <OText
236
- style={styles.orderType}
237
- mRight={5}
238
- numberOfLines={1}
239
- adjustsFontSizeToFit
240
- >
241
- {order.delivery_type === 1
242
- ? t('DELIVERY', 'Delivery')
243
- : order.delivery_type === 2
244
- ? t('PICKUP', 'Pickup')
245
- : order.delivery_type === 3
246
- ? t('EAT_IN', 'Eat in')
247
- : order.delivery_type === 4
248
- ? t('CURBSIDE', 'Curbside')
249
- : t('DRIVER_THRU', 'Driver thru')}
250
- {` · ${getOrderStatus(order.status)}`}
251
- </OText>
252
- </MyOrderOptions>
253
- )}
254
- </Information>
255
- </Card>
256
- </TouchableOpacity>
257
- {isLogisticOrder && (
258
- <AcceptOrRejectOrder>
259
- {!!order?.order_group_id && !!order?.order_group ? (
260
- <OButton
261
- text={t('VIEW_ORDER', 'View order')}
262
- onClick={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
263
- bgColor={theme.colors.blueLight}
264
- borderColor={theme.colors.blueLight}
265
- imgRightSrc={null}
266
- style={{ borderRadius: 7, height: 40 }}
267
- parentStyle={{ width: '100%' }}
268
- textStyle={{ color: theme.colors.primary }}
269
- />
270
- ) : (
271
- <>
272
- <OButton
273
- text={t('REJECT', 'Reject')}
274
- onClick={() => handleClickLogisticOrder(2, _order?.id)}
275
- bgColor={theme.colors.danger}
276
- borderColor={theme.colors.danger}
277
- imgRightSrc={null}
278
- style={{ borderRadius: 7, height: 40 }}
279
- parentStyle={{ width: '45%' }}
280
- textStyle={{ color: theme.colors.dangerText }}
281
- />
282
- <OButton
283
- text={t('ACCEPT', 'Accept')}
284
- onClick={() => handleClickLogisticOrder(1, _order?.id)}
285
- bgColor={theme.colors.successOrder}
286
- borderColor={theme.colors.successOrder}
287
- imgRightSrc={null}
288
- style={{ borderRadius: 7, height: 40 }}
289
- parentStyle={{ width: '45%' }}
290
- textStyle={{ color: theme.colors.successText }}
291
- />
292
- </>
293
- )}
294
- </AcceptOrRejectOrder>
295
- )}
296
- </View>
331
+ <OrdersList key={order.id} order={order} _order={_order} />
297
332
  )
298
333
  }
299
- )}
334
+ )
335
+ }
336
+
337
+ <OModal
338
+ open={openModal}
339
+ onClose={() => setOpenModal(false)}
340
+ entireModal
341
+ customClose
342
+ >
343
+ <AcceptOrRejectOrder
344
+ notShowCustomerPhone={false}
345
+ appTitle={props.appTitle}
346
+ customerCellphone={orderUpdateStatus.order?.customer?.cellphone}
347
+ action={orderUpdateStatus.action}
348
+ orderId={orderUpdateStatus.ids?.[0]}
349
+ actions={props.actions}
350
+ orderTitle={props.orderTitle}
351
+ handleUpdateOrder={ordersGroupAction}
352
+ closeModal={() => setOpenModal(false)}
353
+ />
354
+ </OModal>
355
+ <OModal
356
+ open={!!openReviewModal?.order}
357
+ onClose={() => setOpenReviewModal({ order: null, ids: [], customerId: null })}
358
+ entireModal
359
+ customClose
360
+ >
361
+ <ReviewCustomer
362
+ order={openReviewModal?.order}
363
+ closeModal={() => setOpenReviewModal({ order: null, ids: [], customerId: null })}
364
+ onClose={() => setOpenReviewModal({ order: null, ids: [], customerId: null })}
365
+ handleCustomCustomerReview={(body: any) => handleSendCustomerReview({
366
+ onClose: setOpenReviewModal({ order: null, ids: [], customerId: null }),
367
+ customerId: openReviewModal?.customerId,
368
+ orderIds: openReviewModal?.ids,
369
+ body
370
+ })}
371
+ />
372
+ </OModal>
373
+ <OModal
374
+ open={openMapViewModal.open}
375
+ onClose={() => setOpenMapViewModal({ ...openMapViewModal, open: false })}
376
+ entireModal
377
+ customClose
378
+ >
379
+ <GoogleMap
380
+ readOnly
381
+ navigation={props.navigation}
382
+ location={openMapViewModal.customerLocation}
383
+ locations={openMapViewModal.locations}
384
+ handleOpenMapView={() => setOpenMapViewModal({
385
+ ...openMapViewModal,
386
+ open: !openMapViewModal
387
+ })}
388
+ />
389
+ </OModal>
300
390
  </>
301
391
  );
302
392
  };
@@ -33,7 +33,6 @@ export const NotificationIcon = styled.View`
33
33
  export const AcceptOrRejectOrder = styled.View`
34
34
  flex-direction: row;
35
35
  justify-content: space-between;
36
- flex: 1;
37
36
  margin: 10px;
38
37
  `
39
38
  export const Timestatus = styled.View`
@@ -42,4 +41,33 @@ export const Timestatus = styled.View`
42
41
  height: 55px;
43
42
  border-radius: 20px;
44
43
  top: 5px;
45
- `
44
+ `
45
+
46
+ export const AccordionSection = styled.View`
47
+ background: #FFF;
48
+ padding-vertical: 10px;
49
+ `
50
+
51
+ export const Accordion = styled.TouchableOpacity`
52
+ flex-direction: column;
53
+ justify-content: space-between;
54
+ align-items: center;
55
+ paddingVertical: 0;
56
+ marginLeft: 3px;
57
+ `
58
+
59
+ export const ContentInfo = styled.View`
60
+ flex-direction: row;
61
+ justify-content: space-between;
62
+ align-items: flex-start;
63
+ overflow: hidden;
64
+ `
65
+
66
+ export const AccordionContent = styled.View`
67
+ overflow: hidden;
68
+ `
69
+
70
+ export const ProductOptionsList = styled.View`
71
+ margin-top: 20px;
72
+ margin-left: 20px;
73
+ `