ordering-ui-react-native 0.16.47-release → 0.16.48-release

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,17 +1,16 @@
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 {
@@ -23,25 +22,23 @@ export const PreviousOrders = (props: any) => {
23
22
  handleClickLogisticOrder,
24
23
  slaSettingTime,
25
24
  currentTabSelected,
26
- currentOrdenSelected
25
+ currentOrdenSelected,
26
+ handleChangeOrderStatus,
27
+ handleSendCustomerReview
27
28
  } = props;
29
+
30
+ let hash: any = {};
28
31
  const [, t] = useLanguage();
29
- const [{ parseDate, optimizeImage }] = useUtils();
30
- const [configState] = useConfig()
31
32
  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
-
38
- const [orientationState] = useDeviceOrientation();
39
33
 
40
- const IS_PORTRAIT = orientationState.orientation === PORTRAIT
34
+ const [, setCurrentTime] = useState()
35
+ const [openModal, setOpenModal] = useState(false)
36
+ const [openReviewModal, setOpenReviewModal] = useState({ order: null, ids: [], customerId: null })
37
+ const [openMapViewModal, setOpenMapViewModal] = useState<any>({ open: false, customerLocation: null, locations: [] })
38
+ const [orderUpdateStatus, setOrderUpdateStatus] = useState<any>({ action: '', ids: [], body: {}, order: {} })
41
39
 
42
- const platformIOS = Platform as PlatformIOSStatic
43
- const isIpad = platformIOS.isPad
44
- const isTablet = DeviceInfo.isTablet();
40
+ const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
41
+ const viewMapStatus = [9, 18, 19, 23]
45
42
 
46
43
  const handlePressOrder = (order: any) => {
47
44
  if (order?.locked && isLogisticOrder) return
@@ -54,85 +51,126 @@ export const PreviousOrders = (props: any) => {
54
51
  }
55
52
  };
56
53
 
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
- });
54
+ const OrdersList = (props: any) => {
55
+ const { order, _order, hideBtns } = props
56
+ return (
57
+ <View
58
+ style={{
59
+ backgroundColor: currentOrdenSelected === order?.id ? theme.colors.gray100 : order?.locked && isLogisticOrder ? '#ccc' : '#fff',
60
+ marginBottom: isLogisticOrder ? 10 : 0
61
+ }}
62
+ >
63
+ <OrderItem
64
+ order={order}
65
+ _order={_order}
66
+ isLogisticOrder={isLogisticOrder}
67
+ handlePressOrder={handlePressOrder}
68
+ currentTabSelected={currentTabSelected}
69
+ getOrderStatus={getOrderStatus}
70
+ />
71
+ {isLogisticOrder && !hideBtns && (
72
+ <AcceptOrRejectOrderStyle>
73
+ {!!order?.order_group_id && !!order?.order_group ? (
74
+ <OButton
75
+ text={t('VIEW_ORDER', 'View order')}
76
+ onClick={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
77
+ bgColor={theme.colors.blueLight}
78
+ borderColor={theme.colors.blueLight}
79
+ imgRightSrc={null}
80
+ style={{ borderRadius: 7, height: 40 }}
81
+ parentStyle={{ width: '100%' }}
82
+ textStyle={{ color: theme.colors.primary }}
83
+ />
84
+ ) : (
85
+ <>
86
+ <OButton
87
+ text={t('REJECT', 'Reject')}
88
+ onClick={() => handleClickLogisticOrder(2, _order?.id)}
89
+ bgColor={theme.colors.danger}
90
+ borderColor={theme.colors.danger}
91
+ imgRightSrc={null}
92
+ style={{ borderRadius: 7, height: 40 }}
93
+ parentStyle={{ width: '45%' }}
94
+ textStyle={{ color: theme.colors.dangerText }}
95
+ />
96
+ <OButton
97
+ text={t('ACCEPT', 'Accept')}
98
+ onClick={() => handleClickLogisticOrder(1, _order?.id)}
99
+ bgColor={theme.colors.successOrder}
100
+ borderColor={theme.colors.successOrder}
101
+ imgRightSrc={null}
102
+ style={{ borderRadius: 7, height: 40 }}
103
+ parentStyle={{ width: '45%' }}
104
+ textStyle={{ color: theme.colors.successText }}
105
+ />
106
+ </>
107
+ )}
108
+ </AcceptOrRejectOrderStyle>
109
+ )}
110
+ </View>
111
+ )
112
+ }
101
113
 
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)
114
+ const ordersGroupAction = (param1 = '', param2 = '', { order, action, body, ids }: any = {}) => {
115
+ setOrderUpdateStatus({ ...orderUpdateStatus, action, ids, body, order })
116
+ if (!param1) setOpenModal(true)
117
+ if (param1) {
118
+ setOpenModal(false)
119
+ handleChangeOrderStatus &&
120
+ handleChangeOrderStatus(param1, orderUpdateStatus.ids, param2)
121
+ }
112
122
  }
113
123
 
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
124
+ const handleOpenMapView = ({ orders }: any) => {
125
+ const locations: any = []
127
126
 
128
- const finalTaget = sign + day + restHours + ':' + restMins
129
- return finalTaget
130
- }
127
+ orders.map((_order: any) => {
128
+ if (_order?.driver?.location) {
129
+ locations.push({
130
+ ..._order?.driver?.location,
131
+ title: _order?.driver?.name ?? t('DRIVER', 'Driver'),
132
+ icon:
133
+ _order?.driver?.photo ||
134
+ 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png',
135
+ level: 4,
136
+ })
137
+ }
138
+ if (_order?.business?.location) {
139
+ locations.push({
140
+ ..._order?.business?.location,
141
+ title: _order?.business?.name,
142
+ address: {
143
+ addressName: _order?.business?.address,
144
+ zipcode: _order?.business?.zipcode
145
+ },
146
+ icon:
147
+ _order?.business?.logo ||
148
+ 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://res.cloudinary.com/ordering2/image/upload/v1654619525/hzegwosnplvrbtjkpfi6.png',
149
+ level: 2,
150
+ })
151
+ }
152
+ if (_order?.customer?.location) {
153
+ locations.push({
154
+ ..._order?.customer?.location,
155
+ title: _order?.customer?.name ?? t('CUSTOMER', 'Customer'),
156
+ address: {
157
+ addressName: _order?.customer?.address,
158
+ zipcode: _order?.customer?.zipcode
159
+ },
160
+ icon:
161
+ _order?.customer?.photo ||
162
+ 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
163
+ level: 3,
164
+ })
165
+ }
166
+ })
131
167
 
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'
168
+ setOpenMapViewModal({
169
+ ...openMapViewModal,
170
+ open: true,
171
+ locations,
172
+ customerLocation: orders[0]?.customer?.location
173
+ })
136
174
  }
137
175
 
138
176
  useEffect(() => {
@@ -144,159 +182,211 @@ export const PreviousOrders = (props: any) => {
144
182
  return () => clearInterval(interval)
145
183
  }, [])
146
184
 
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
185
 
158
186
  return (
159
187
  <>
160
- {orders && orders?.length > 0 &&
161
- orders
162
- ?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
163
- ?.map((_order: any) => {
164
- const order = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
165
- 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}
188
+ {orders && orders?.length > 0 && orders.map((_order: any) => {
189
+ const order = !Array.isArray(_order) && (_order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order)
190
+ const _ordersGrouped = Array.isArray(_order) && Object.fromEntries(_order)
191
+ return (
192
+ _ordersGrouped ? (
193
+ <View key={_order[0]} style={{ marginBottom: 10 }}>
194
+ {Object.keys(_ordersGrouped).map((k, idx) => (
195
+ <OrdersGroupedItem
196
+ key={`${k}_${idx}`}
197
+ groupId={k}
198
+ orders={_ordersGrouped[k]}
179
199
  >
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}
200
+ {_ordersGrouped[k]?.length > 0 &&
201
+ _ordersGrouped[k]
202
+ ?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
203
+ ?.map((_order: any) => {
204
+ const order_ = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
205
+ return (
206
+ <OrdersList key={order_.id} order={order_} _order={_order} hideBtns />
207
+ )
208
+ }
209
+ )
210
+ }
211
+ {_ordersGrouped[k][0]?.status === 0 && (
212
+ <AcceptOrRejectOrderStyle>
213
+ <OButton
214
+ text={t('REJECT_ALL', 'Reject all')}
215
+ bgColor={theme.colors.danger100}
216
+ borderColor={theme.colors.danger100}
217
+ imgRightSrc={null}
218
+ style={{ borderRadius: 7, height: 40 }}
219
+ parentStyle={{ width: '45%' }}
220
+ textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
221
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
222
+ action: 'reject',
223
+ order: _ordersGrouped[k][0],
224
+ ids: _ordersGrouped[k].map((o: any) => o.id),
225
+ handleChangeOrderStatus
226
+ })}
192
227
  />
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
- </>
228
+ <OButton
229
+ text={t('ACCEPT_ALL', 'Accept all')}
230
+ bgColor={theme.colors.success100}
231
+ borderColor={theme.colors.success100}
232
+ imgRightSrc={null}
233
+ style={{ borderRadius: 7, height: 40 }}
234
+ parentStyle={{ width: '45%' }}
235
+ textStyle={{ color: theme.colors.success500, fontSize: 12 }}
236
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
237
+ action: 'accept',
238
+ order: _ordersGrouped[k][0],
239
+ ids: _ordersGrouped[k].map((o: any) => o.id),
240
+ handleChangeOrderStatus
241
+ })}
242
+ />
243
+ </AcceptOrRejectOrderStyle>
244
+ )}
245
+ <View>
246
+ {_ordersGrouped[k][0]?.status === 7 && (
247
+ <OButton
248
+ text={t('READY_FOR_PICKUP', 'Ready for pickup')}
249
+ bgColor={theme.colors.primaryLight}
250
+ borderColor={theme.colors.primaryLight}
251
+ imgRightSrc={null}
252
+ style={{ borderRadius: 7, height: 40 }}
253
+ parentStyle={{ width: '100%' }}
254
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
255
+ onClick={() => handleChangeOrderStatus(
256
+ 4,
257
+ _ordersGrouped[k].map((o: any) => o.id),
231
258
  )}
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 ? (
259
+ />
260
+ )}
261
+ </View>
262
+ <View>
263
+ {viewMapStatus.includes(_ordersGrouped[k][0]?.status) && (
260
264
  <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
+ text={t('TRACK_REAL_TIME_POSITION', 'Track real time position')}
266
+ bgColor={theme.colors.primaryLight}
267
+ borderColor={theme.colors.primaryLight}
265
268
  imgRightSrc={null}
266
269
  style={{ borderRadius: 7, height: 40 }}
267
270
  parentStyle={{ width: '100%' }}
268
- textStyle={{ color: theme.colors.primary }}
271
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
272
+ onClick={() => handleOpenMapView({ orders: _ordersGrouped[k] })}
269
273
  />
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
274
  )}
294
- </AcceptOrRejectOrder>
295
- )}
296
- </View>
297
- )
298
- }
299
- )}
275
+ </View>
276
+ {_ordersGrouped[k][0]?.status === 4 &&
277
+ ![1].includes(_ordersGrouped[k][0]?.delivery_type) &&
278
+ (
279
+ <AcceptOrRejectOrderStyle>
280
+ <OButton
281
+ text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
282
+ bgColor={theme.colors.danger100}
283
+ borderColor={theme.colors.danger100}
284
+ imgRightSrc={null}
285
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
286
+ parentStyle={{ width: '45%' }}
287
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
288
+ onClick={() => handleChangeOrderStatus(
289
+ 17,
290
+ _ordersGrouped[k].map((o: any) => o.id),
291
+ )}
292
+ />
293
+ <OButton
294
+ text={t('PICKUP_COMPLETED_BY_CUSTOMER', 'Pickup completed by customer')}
295
+ bgColor={theme.colors.success100}
296
+ borderColor={theme.colors.success100}
297
+ imgRightSrc={null}
298
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
299
+ parentStyle={{ width: '45%' }}
300
+ textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
301
+ onClick={() => handleChangeOrderStatus(
302
+ 15,
303
+ _ordersGrouped[k].map((o: any) => o.id),
304
+ )}
305
+ />
306
+ </AcceptOrRejectOrderStyle>
307
+ )}
308
+ {!_ordersGrouped[k][0]?.user_review &&
309
+ pastOrderStatuses.includes(_ordersGrouped[k][0]?.status) &&
310
+ (
311
+ <OButton
312
+ text={t('REVIEW_CUSTOMER', 'Review customer')}
313
+ bgColor={theme.colors.primary}
314
+ borderColor={theme.colors.primary}
315
+ imgRightSrc={null}
316
+ style={{ borderRadius: 8, height: 40 }}
317
+ parentStyle={{ width: '100%' }}
318
+ textStyle={{ color: theme.colors.white }}
319
+ onClick={() => setOpenReviewModal({
320
+ order: _ordersGrouped[k][0],
321
+ customerId: _ordersGrouped[k][0]?.customer_id,
322
+ ids: _ordersGrouped[k].map((o: any) => o.id)
323
+ })}
324
+ />
325
+ )}
326
+ </OrdersGroupedItem>
327
+ ))}
328
+ </View>
329
+ ) : (
330
+ <View key={order.id}>
331
+ <OrdersList order={order} _order={_order} />
332
+ </View>
333
+ )
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
+ `