ordering-ui-react-native 0.12.50 → 0.12.54

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.50",
3
+ "version": "0.12.54",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,15 +1,17 @@
1
1
  import React, { useState, useEffect, useRef } from 'react';
2
2
  import { Dimensions, StyleSheet, View, SafeAreaView } from 'react-native';
3
- import MapView, { PROVIDER_GOOGLE, Marker, Region } from 'react-native-maps';
3
+ import MapView, { PROVIDER_GOOGLE, Marker, Region, Callout } from 'react-native-maps';
4
4
  import Geocoder from 'react-native-geocoding';
5
5
  import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
6
6
  import { GoogleMapsParams } from '../../types';
7
7
  import Alert from '../../providers/AlertProvider';
8
- import { OIconButton, OIcon } from '../shared';
8
+ import { OIconButton, OIcon, OText, OButton } from '../shared';
9
9
  import { FloatingButton } from '../FloatingButton';
10
10
  import Icon from 'react-native-vector-icons/FontAwesome5';
11
11
  import { useTheme } from 'styled-components/native';
12
12
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
13
+ import { useLocation } from '../../hooks/useLocation';
14
+ import { showLocation } from 'react-native-map-link';
13
15
 
14
16
  export const GoogleMap = (props: GoogleMapsParams) => {
15
17
  const {
@@ -30,6 +32,15 @@ export const GoogleMap = (props: GoogleMapsParams) => {
30
32
  navigation,
31
33
  } = props;
32
34
 
35
+ const {
36
+ hasLocation,
37
+ initialPosition,
38
+ followUserLocation,
39
+ getCurrentLocation,
40
+ userLocation,
41
+ stopFollowUserLocation,
42
+ } = useLocation();
43
+
33
44
  const { top } = useSafeAreaInsets();
34
45
  const theme = useTheme();
35
46
  const [, t] = useLanguage();
@@ -64,7 +75,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
64
75
  ERROR_MAX_LIMIT_LOCATION_TO: 'Sorry, You can only set the position to',
65
76
  };
66
77
 
67
- const MARKERS =
78
+ let MARKERS =
68
79
  locations &&
69
80
  locations.map((location: { lat: number; lng: number; level: number }) => {
70
81
  return location.level === 4 && driverLocation?.lat
@@ -221,6 +232,18 @@ export const GoogleMap = (props: GoogleMapsParams) => {
221
232
  fitAllMarkers();
222
233
  }
223
234
  }, [isMapReady]);
235
+ useEffect(() => {
236
+ if (!locations) return
237
+ MARKERS = locations.map((location: { lat: number; lng: number; level: number }) => {
238
+ return location.level === 4 && driverLocation?.lat
239
+ ? {
240
+ latitude: driverLocation?.lat,
241
+ longitude: driverLocation?.lng,
242
+ }
243
+ : { latitude: location.lat, longitude: location.lng };
244
+ })
245
+ fitAllMarkers();
246
+ }, [driverLocation])
224
247
 
225
248
  const styles = StyleSheet.create({
226
249
  map: {
@@ -279,7 +302,13 @@ export const GoogleMap = (props: GoogleMapsParams) => {
279
302
  i: number,
280
303
  ) => (
281
304
  <React.Fragment key={i}>
282
- <Marker coordinate={location} title={locations[i]?.title}>
305
+ <Marker
306
+ coordinate={location}
307
+ onPress={() => {
308
+ mapRef.current?.animateCamera({
309
+ center: { latitude: location.latitude, longitude:location.longitude },
310
+ })}}
311
+ >
283
312
  <Icon
284
313
  name="map-marker"
285
314
  size={50}
@@ -296,6 +325,51 @@ export const GoogleMap = (props: GoogleMapsParams) => {
296
325
  height={25}
297
326
  />
298
327
  </View>
328
+ <Callout
329
+ onPress={() => {
330
+ showLocation({
331
+ latitude: location.latitude,
332
+ longitude: location.longitude,
333
+ sourceLatitude: userLocation.latitude,
334
+ sourceLongitude: userLocation.longitude,
335
+ naverCallerName: 'com.businessapp',
336
+ dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
337
+ dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
338
+ cancelText: t('CANCEL', 'Cancel'),
339
+ })
340
+ }}
341
+ >
342
+ <View style={{flex: 1,width: 250, paddingRight: 10, paddingLeft: 10, justifyContent:'space-between' }}>
343
+ <View style={{flex: 1, marginBottom: 20}}>
344
+ <OText size={16} weight={'bold'} style={{paddingTop: 10, marginBottom: 10}}>{locations[i]?.title}</OText>
345
+ { locations[i]?.address && (
346
+ <>
347
+ <OText size={16} >{locations[i]?.address.addressName}</OText>
348
+ <OText size={16} >{locations[i]?.address.zipcode}</OText>
349
+ </>
350
+ )}
351
+ </View>
352
+ <OButton
353
+ text={t('GO_TO_THIS_LOCATION', 'Go to this location')}
354
+ imgRightSrc={null}
355
+ textStyle={{
356
+ color: theme.colors.white,
357
+ fontFamily: 'Poppins',
358
+ fontStyle: 'normal',
359
+ fontWeight: 'normal',
360
+ fontSize: 16
361
+ }}
362
+ style={{
363
+ alignContent:'center',
364
+ borderRadius: 10,
365
+ height: 35,
366
+ bottom:10
367
+ }}
368
+ bgColor={theme.colors.primary}
369
+ borderColor={theme.colors.primary}
370
+ />
371
+ </View>
372
+ </Callout>
299
373
  </Marker>
300
374
  </React.Fragment>
301
375
  ),
@@ -319,10 +319,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
319
319
  }
320
320
  }, [messagesReadList]);
321
321
 
322
- const locations = [
322
+ let locations = [
323
323
  {
324
324
  ...order?.driver?.location,
325
- title: t('DRIVER', 'Driver'),
325
+ title: order?.driver?.name ?? t('DRIVER', 'Driver'),
326
326
  icon:
327
327
  order?.driver?.photo ||
328
328
  'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png',
@@ -331,12 +331,20 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
331
331
  {
332
332
  ...order?.business?.location,
333
333
  title: order?.business?.name,
334
+ address: {
335
+ addressName: order?.business?.address,
336
+ zipcode: order?.business?.zipcode
337
+ },
334
338
  icon: order?.business?.logo || theme.images.dummies.businessLogo,
335
339
  level: 2,
336
340
  },
337
341
  {
338
342
  ...order?.customer?.location,
339
- title: t('CUSTOMER', 'Customer'),
343
+ title: order?.customer?.name ?? t('CUSTOMER', 'Customer'),
344
+ address: {
345
+ addressName: order?.customer?.address,
346
+ zipcode: order?.customer?.zipcode
347
+ },
340
348
  icon:
341
349
  order?.customer?.photo ||
342
350
  'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
@@ -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,18 +27,19 @@ 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)
41
- const [isCustomerReviewed, setIsCustomerReviewed] = useState(false)
42
43
 
43
44
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
44
45
 
@@ -63,13 +64,11 @@ export const OrderContentComponent = (props: OrderContent) => {
63
64
  }
64
65
  })
65
66
 
66
- const handleSuccessReviewed = () => {
67
- setOpenReviewModal(false)
68
- setIsCustomerReviewed(true)
69
- }
70
-
71
67
  return (
72
- <OrderContent>
68
+ <OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
69
+ {isOrderGroup && (
70
+ <OText size={18}>{t('ORDER', 'Order')} #{isOrderGroup ? order?.order_group_id : order?.id}</OText>
71
+ )}
73
72
  <OrderBusiness>
74
73
  <OText style={{ marginBottom: 5 }} size={16} weight="600">
75
74
  {t('BUSINESS_DETAILS', 'Business details')}
@@ -148,42 +147,52 @@ export const OrderContentComponent = (props: OrderContent) => {
148
147
  <OText style={{ marginBottom: 5 }} size={16} weight="600">
149
148
  {t('CUSTOMER_DETAILS', 'Customer details')}
150
149
  </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>
150
+ {
151
+ (order?.customer?.name || order?.customer?.lastname) && (
152
+ <View style={{ flexDirection: 'row' }}>
153
+ <OText numberOfLines={2} mBottom={4}>
154
+ {order?.customer?.name && (
155
+ <OText
156
+ numberOfLines={1}
157
+ mBottom={4}
158
+ ellipsizeMode="tail"
159
+ space>
160
+ {order?.customer?.name}
161
+ </OText>
162
+ )}
163
+ {order?.customer?.middle_name && (
164
+ <OText
165
+ numberOfLines={1}
166
+ mBottom={4}
167
+ ellipsizeMode="tail"
168
+ space>
169
+ {order?.customer?.middle_name}
170
+ </OText>
171
+ )}
172
+ {order?.customer?.lastname && (
173
+ <OText
174
+ numberOfLines={1}
175
+ mBottom={4}
176
+ ellipsizeMode="tail"
177
+ space>
178
+ {order?.customer?.lastname}
179
+ </OText>
180
+ )}
181
+ {
182
+ order?.customer?.second_lastname && (
183
+ <OText
184
+ numberOfLines={1}
185
+ mBottom={4}
186
+ ellipsizeMode="tail"
187
+ space>
188
+ {order?.customer?.second_lastname}
189
+ </OText>
190
+ )
191
+ }
192
+ </OText>
193
+ </View>
194
+ )
195
+ }
187
196
 
188
197
  {!!order?.customer?.email && (
189
198
  <View style={styles.linkWithIcons}>
@@ -250,7 +259,7 @@ export const OrderContentComponent = (props: OrderContent) => {
250
259
  {order?.customer?.zipcode}
251
260
  </OText>
252
261
  )}
253
- {/* {!order?.user_review && pastOrderStatuses.includes(order?.status) && !isCustomerReviewed && (
262
+ {!order?.user_review && pastOrderStatuses.includes(order?.status) && (
254
263
  <OButton
255
264
  style={styles.btnReview}
256
265
  textStyle={{ color: theme.colors.white }}
@@ -258,7 +267,7 @@ export const OrderContentComponent = (props: OrderContent) => {
258
267
  imgRightSrc={false}
259
268
  onClick={() => setOpenReviewModal(true)}
260
269
  />
261
- )} */}
270
+ )}
262
271
  </OrderCustomer>
263
272
 
264
273
  <OrderProducts>
@@ -430,7 +439,7 @@ export const OrderContentComponent = (props: OrderContent) => {
430
439
  <ReviewCustomer
431
440
  order={order}
432
441
  closeModal={() => setOpenReviewModal(false)}
433
- onClose={() => handleSuccessReviewed()}
442
+ onClose={() => setOpenReviewModal(false)}
434
443
  />
435
444
  </OModal>
436
445
  </OrderContent>
@@ -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>
@@ -172,24 +172,33 @@ export const ProductOptionsUI = (props: any) => {
172
172
  </View>
173
173
  </Placeholder>
174
174
  ) : (
175
- <>
176
- <OText style={{ flex: I18nManager.isRTL ? 0 : 1, ...theme.labels.large }}>{product?.name || productCart.name}</OText>
177
- {/* <OText size={20} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText> */}
178
- </>
175
+ <View style={{ flexDirection: 'column', width: '100%' }}>
176
+ <OText size={20} style={{ flex: I18nManager.isRTL ? 0 : 1, marginBottom: 10 }}>{product?.name || productCart.name}</OText>
177
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
178
+ {((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (product?.estimated_person)) && (
179
+ <OText size={14} style={{ marginBottom: 10, flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'}>
180
+ {
181
+ ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
182
+ && <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
183
+ }
184
+ {product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
185
+ <>&nbsp;&#183;&nbsp;</>
186
+ )}
187
+ {product?.estimated_person
188
+ && <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
189
+ }
190
+ </OText>
191
+ )}
192
+ </View>
193
+ <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
194
+ </View>
179
195
  )}
180
196
  </ProductTitle>
181
- <ProductDescription>
182
- <OText style={theme.labels.small as TextStyle} color={theme.colors.textSecondary}>{product?.description || productCart?.description}</OText>
183
- {(
184
- (product?.sku && product?.sku !== '-1' && product?.sku !== '1') ||
185
- (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1')
186
- ) && (
187
- <>
188
- <OText size={20}>{t('SKU', 'Sku')}</OText>
189
- <OText>{product?.sku || productCart?.sku}</OText>
190
- </>
191
- )}
192
- </ProductDescription>
197
+ {(product?.description || productCart?.description) && (
198
+ <ProductDescription>
199
+ <OText color={theme.colors.textSecondary}>{product?.description || productCart?.description}</OText>
200
+ </ProductDescription>
201
+ )}
193
202
  {loading && !product ? (
194
203
  <>
195
204
  {[...Array(2)].map((item, i) => (
@@ -319,18 +328,18 @@ export const ProductOptionsUI = (props: any) => {
319
328
 
320
329
  <View style={{ width: '100%' }}>
321
330
  {/* {productCart && !isSoldOut && maxProductQuantity > 0 && auth && orderState.options?.address_id && ( */}
322
- <OButton
323
- onClick={() => handleSaveProduct()}
324
- imgRightSrc=''
325
- text={`${orderState.loading ? t('LOADING', 'Loading') : editMode ? t('UPDATE', 'Update') : t('ADD_TO_CART', 'Add to Cart')}`}
326
- textSub={`${orderState.loading ? '' : productCart.total ? parsePrice(productCart?.total) : ''}`}
327
- textStyle={{ color: saveErrors ? theme.colors.textSecondary : theme.colors.white, fontSize: 14, fontWeight: Platform.OS === 'ios' ? '600' : 'bold' }}
328
- style={{
329
- backgroundColor: saveErrors ? theme.colors.backgroundGray300 : theme.colors.primary,
330
- borderWidth: 1, shadowOpacity: 0, height: 40,
331
- borderColor: saveErrors ? theme.colors.backgroundGray300 : theme.colors.primary,
332
- }}
333
- />
331
+ <OButton
332
+ onClick={() => handleSaveProduct()}
333
+ imgRightSrc=''
334
+ text={`${orderState.loading ? t('LOADING', 'Loading') : editMode ? t('UPDATE', 'Update') : t('ADD_TO_CART', 'Add to Cart')}`}
335
+ textSub={`${orderState.loading ? '' : productCart.total ? parsePrice(productCart?.total) : ''}`}
336
+ textStyle={{ color: saveErrors ? theme.colors.textSecondary : theme.colors.white, fontSize: 14, fontWeight: Platform.OS === 'ios' ? '600' : 'bold' }}
337
+ style={{
338
+ backgroundColor: saveErrors ? theme.colors.backgroundGray300 : theme.colors.primary,
339
+ borderWidth: 1, shadowOpacity: 0, height: 40,
340
+ borderColor: saveErrors ? theme.colors.backgroundGray300 : theme.colors.primary,
341
+ }}
342
+ />
334
343
  {/* )} */}
335
344
  {auth && !orderState.options?.address_id && (
336
345
  orderState.loading ? (
@@ -120,7 +120,7 @@ export const ProductOptionsUI = (props: any) => {
120
120
  <ProductHeader
121
121
  source={{ uri: product?.images || productCart?.images }}
122
122
  resizeMode={'contain'}
123
- style={{height: windowWidth, maxHeight: windowWidth}}
123
+ style={{ height: windowWidth, maxHeight: windowWidth }}
124
124
  />
125
125
  </>
126
126
  )}
@@ -135,22 +135,33 @@ export const ProductOptionsUI = (props: any) => {
135
135
  </View>
136
136
  </Placeholder>
137
137
  ) : (
138
- <OText mBottom={7} style={{ flex: I18nManager.isRTL ? 0 : 1, ...theme.labels.subtitle, fontWeight: Platform.OS === 'ios' ? '600' : 'bold' }}>{product?.name || productCart.name}</OText>
138
+ <View style={{ flexDirection: 'column', width: '100%' }}>
139
+ <OText size={20} style={{ flex: I18nManager.isRTL ? 0 : 1, marginBottom: 10, fontWeight: Platform.OS === 'ios' ? '600' : 'bold' }}>{product?.name || productCart.name}</OText>
140
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
141
+ {((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (product?.estimated_person)) && (
142
+ <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
143
+ {
144
+ ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
145
+ && <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
146
+ }
147
+ {product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
148
+ <>&nbsp;&#183;&nbsp;</>
149
+ )}
150
+ {product?.estimated_person
151
+ && <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
152
+ }
153
+ </OText>
154
+ )}
155
+ </View>
156
+ <OText size={16} mBottom={7} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
157
+ </View>
139
158
  )}
140
159
  </ProductTitle>
141
- <ProductDescription>
142
- <OText mBottom={7} style={{ ...theme.labels.small }} color={theme.colors.textSecondary}>{product?.description?.trim() || productCart?.description?.trim()}</OText>
143
- <OText style={{ flex: I18nManager.isRTL ? 1 : 0, ...theme.labels.subtitle, fontWeight: Platform.OS === 'ios' ? '600' : 'bold' }} color={theme.colors.textPrimary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
144
- {(
145
- (product?.sku && product?.sku !== '-1' && product?.sku !== '1') ||
146
- (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1')
147
- ) && (
148
- <>
149
- <OText size={20}>{t('SKU', 'Sku')}</OText>
150
- <OText>{product?.sku || productCart?.sku}</OText>
151
- </>
152
- )}
153
- </ProductDescription>
160
+ {(product?.description || productCart?.description) && (
161
+ <ProductDescription>
162
+ <OText mBottom={7} style={{ ...theme.labels.small }} color={theme.colors.textSecondary}>{product?.description?.trim() || productCart?.description?.trim()}</OText>
163
+ </ProductDescription>
164
+ )}
154
165
  <View style={{ height: 16, backgroundColor: theme.colors.secundary, marginHorizontal: -40, marginBottom: 20 }} />
155
166
  {loading && !product ? (
156
167
  <>
@@ -13,7 +13,7 @@ import Swiper from 'react-native-swiper'
13
13
  import FastImage from 'react-native-fast-image';
14
14
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
15
15
 
16
- import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, AppRegistry } from 'react-native';
16
+ import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, AppRegistry, I18nManager } from 'react-native';
17
17
 
18
18
  import {
19
19
  ProductHeader,
@@ -116,7 +116,7 @@ export const ProductOptionsUI = (props: any) => {
116
116
  slide1: {
117
117
  flex: 1,
118
118
  },
119
- mainSwiper : {
119
+ mainSwiper: {
120
120
  height: 258,
121
121
  },
122
122
  swiperButton: {
@@ -196,7 +196,7 @@ export const ProductOptionsUI = (props: any) => {
196
196
  useEffect(() => {
197
197
  const productImgList: any = []
198
198
  product?.images && productImgList.push(product.images)
199
- if(product?.gallery && product?.gallery.length > 0) {
199
+ if (product?.gallery && product?.gallery.length > 0) {
200
200
  for (const img of product?.gallery) {
201
201
  productImgList.push(img.file)
202
202
  }
@@ -296,7 +296,7 @@ export const ProductOptionsUI = (props: any) => {
296
296
  name="caretleft"
297
297
  color={theme.colors.white}
298
298
  size={13}
299
- // style={styles.starIcon}
299
+ // style={styles.starIcon}
300
300
  />
301
301
  </View>
302
302
  }
@@ -306,7 +306,7 @@ export const ProductOptionsUI = (props: any) => {
306
306
  name="caretright"
307
307
  color={theme.colors.white}
308
308
  size={13}
309
- // style={styles.starIcon}
309
+ // style={styles.starIcon}
310
310
  />
311
311
  </View>
312
312
  }
@@ -387,6 +387,20 @@ export const ProductOptionsUI = (props: any) => {
387
387
  style={{ flex: 1, marginBottom: 5 }}>
388
388
  {product?.name || productCart.name}
389
389
  </OText>
390
+ {((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (product?.estimated_person)) && (
391
+ <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
392
+ {
393
+ ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
394
+ && <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
395
+ }
396
+ {product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
397
+ <>&nbsp;&#183;&nbsp;</>
398
+ )}
399
+ {product?.estimated_person
400
+ && <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
401
+ }
402
+ </OText>
403
+ )}
390
404
  <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
391
405
  {productCart.price ? parsePrice(productCart.price) : ''}
392
406
  </OText>
@@ -397,17 +411,6 @@ export const ProductOptionsUI = (props: any) => {
397
411
  <OText color={theme.colors.textSecondary} size={12} lineHeight={18}>
398
412
  {product?.description || productCart?.description}
399
413
  </OText>
400
- {((product?.sku &&
401
- product?.sku !== '-1' &&
402
- product?.sku !== '1') ||
403
- (productCart?.sku &&
404
- productCart?.sku !== '-1' &&
405
- productCart?.sku !== '1')) && (
406
- <>
407
- <OText size={16}>{t('SKU', 'Sku')}</OText>
408
- <OText>{product?.sku || productCart?.sku}</OText>
409
- </>
410
- )}
411
414
  </ProductDescription>
412
415
  {loading && !product ? (
413
416
  <>
@@ -455,25 +458,25 @@ export const ProductOptionsUI = (props: any) => {
455
458
  style={{ marginBottom: 20 }}
456
459
  contentContainerStyle={{ paddingHorizontal: 33 }}
457
460
  >
458
- <TouchableOpacity
459
- key={`eopt_all_0`}
460
- onPress={() => setSelectedOpt(0)}
461
- style={[
462
- styles.extraItem,
463
- {
464
- borderBottomColor: selOpt == 0 ? theme.colors.textNormal : theme.colors.border,
465
- },
466
- ]}>
467
- <OText
468
- color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
469
- size={selOpt == 0 ? 14 : 12}
470
- weight={selOpt == 0 ? '600' : 'normal'}>
471
- {t('ALL', 'All')}
472
- </OText>
473
- </TouchableOpacity>
474
- {product?.extras.map((extra: any) =>
475
- <ExtraOptions key={extra.id} options={extra.options} />
476
- )}
461
+ <TouchableOpacity
462
+ key={`eopt_all_0`}
463
+ onPress={() => setSelectedOpt(0)}
464
+ style={[
465
+ styles.extraItem,
466
+ {
467
+ borderBottomColor: selOpt == 0 ? theme.colors.textNormal : theme.colors.border,
468
+ },
469
+ ]}>
470
+ <OText
471
+ color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
472
+ size={selOpt == 0 ? 14 : 12}
473
+ weight={selOpt == 0 ? '600' : 'normal'}>
474
+ {t('ALL', 'All')}
475
+ </OText>
476
+ </TouchableOpacity>
477
+ {product?.extras.map((extra: any) =>
478
+ <ExtraOptions key={extra.id} options={extra.options} />
479
+ )}
477
480
  </ExtraOptionWrap>
478
481
 
479
482
  {selOpt == 0 ? (
@@ -778,7 +781,7 @@ export const ProductOptionsUI = (props: any) => {
778
781
  isDisabled
779
782
  text={t('LOADING', 'Loading')}
780
783
  imgRightSrc=""
781
- textStyle={{fontSize: 10}}
784
+ textStyle={{ fontSize: 10 }}
782
785
  />
783
786
  ) : (
784
787
  <OButton onClick={navigation.navigate('AddressList')} />
@@ -9,7 +9,7 @@ import {
9
9
  import { useTheme } from 'styled-components/native';
10
10
  import { ProductIngredient } from '../ProductIngredient';
11
11
  import { ProductOption } from '../ProductOption';
12
- import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, useWindowDimensions, Keyboard, KeyboardAvoidingView } from 'react-native';
12
+ import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, useWindowDimensions, Keyboard, KeyboardAvoidingView, I18nManager } from 'react-native';
13
13
 
14
14
  import {
15
15
  ProductHeader,
@@ -312,6 +312,20 @@ export const ProductOptionsUI = (props: any) => {
312
312
  style={{ flex: 1, marginBottom: 5 }}>
313
313
  {product?.name || productCart.name}
314
314
  </OText>
315
+ {((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (product?.estimated_person)) && (
316
+ <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
317
+ {
318
+ ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
319
+ && <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
320
+ }
321
+ {product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
322
+ <>&nbsp;&#183;&nbsp;</>
323
+ )}
324
+ {product?.estimated_person
325
+ && <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
326
+ }
327
+ </OText>
328
+ )}
315
329
  <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
316
330
  {productCart.price ? parsePrice(productCart.price) : ''}
317
331
  </OText>
@@ -322,17 +336,6 @@ export const ProductOptionsUI = (props: any) => {
322
336
  <OText color={theme.colors.textSecondary} size={12} lineHeight={18}>
323
337
  {product?.description || productCart?.description}
324
338
  </OText>
325
- {((product?.sku &&
326
- product?.sku !== '-1' &&
327
- product?.sku !== '1') ||
328
- (productCart?.sku &&
329
- productCart?.sku !== '-1' &&
330
- productCart?.sku !== '1')) && (
331
- <>
332
- <OText size={16}>{t('SKU', 'Sku')}</OText>
333
- <OText>{product?.sku || productCart?.sku}</OText>
334
- </>
335
- )}
336
339
  </ProductDescription>
337
340
  {loading && !product ? (
338
341
  <>
@@ -32,7 +32,7 @@ import {
32
32
  import { OButton, OInput, OText } from '../shared'
33
33
  import { ProductOptionSubOption } from '../ProductOptionSubOption'
34
34
  import { NotFoundSource } from '../NotFoundSource'
35
- import { Placeholder,PlaceholderLine,Fade } from 'rn-placeholder'
35
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
36
36
  import { useTheme } from 'styled-components/native'
37
37
  import MaterialIcon from 'react-native-vector-icons/MaterialIcons'
38
38
 
@@ -149,9 +149,9 @@ export const ProductOptionsUI = (props: any) => {
149
149
  }
150
150
  }
151
151
 
152
- const handleRedirectLogin = (product : any) => {
152
+ const handleRedirectLogin = (product: any) => {
153
153
  onClose()
154
- navigation.navigate('Login', {product: {businessId: product?.businessId, id: product?.id, categoryId: product?.categoryId, slug: businessSlug} })
154
+ navigation.navigate('Login', { product: { businessId: product?.businessId, id: product?.id, categoryId: product?.categoryId, slug: businessSlug } })
155
155
  }
156
156
 
157
157
  const saveErrors = orderState.loading || maxProductQuantity === 0 || Object.keys(errors).length > 0
@@ -215,49 +215,46 @@ export const ProductOptionsUI = (props: any) => {
215
215
  </View>
216
216
  </Placeholder>
217
217
  ) : (
218
- <>
219
- <OText
220
- weight={600}
221
- size={20}
222
- numberOfLines={1}
223
- ellipsizeMode='tail'
224
- style={{
225
- flex: 1,
226
- marginRight: 30,
227
- textAlign: 'left'
228
- }}
229
- >
230
- {product?.name || productCart.name}
231
- </OText>
232
- <OText weight={600} size={20} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
233
- </>
218
+ <View style={{ flexDirection: 'column', width: '100%' }}>
219
+ <OText size={20} style={{ flex: I18nManager.isRTL ? 0 : 1, marginBottom: 10 }}>{product?.name || productCart.name}</OText>
220
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
221
+ {((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (product?.estimated_person)) && (
222
+ <OText size={14} style={{ marginBottom: 10, flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'}>
223
+ {
224
+ ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
225
+ && <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
226
+ }
227
+ {product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
228
+ <>&nbsp;&#183;&nbsp;</>
229
+ )}
230
+ {product?.estimated_person
231
+ && <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
232
+ }
233
+ </OText>
234
+ )}
235
+ </View>
236
+ <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
237
+ </View>
234
238
  )}
235
239
  </ProductTitle>
236
- <ProductDescription>
237
- <OText color={theme.colors.gray} style={{ textAlign: 'left' }}>{product?.description || productCart?.description}</OText>
238
- {(
239
- (product?.sku && product?.sku !== '-1' && product?.sku !== '1') ||
240
- (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1')
241
- ) && (
242
- <>
243
- <OText size={20}>{t('SKU', 'Sku')}</OText>
244
- <OText>{product?.sku || productCart?.sku}</OText>
245
- </>
246
- )}
247
- </ProductDescription>
240
+ {(product?.description || productCart?.description) && (
241
+ <ProductDescription>
242
+ <OText color={theme.colors.gray} style={{ textAlign: 'left', marginBottom: 10 }}>{product?.description || productCart?.description}</OText>
243
+ </ProductDescription>
244
+ )}
248
245
  {loading && !product ? (
249
246
  <>
250
- {[...Array(2)].map((item,i) => (
251
- <Placeholder key={i} style={{marginBottom: 20}} Animation={Fade}>
252
- <PlaceholderLine height={40} style={{ flex: 1, marginTop: 10 }} />
253
- {[...Array(3)].map((item,i) => (
254
- <View key={i} style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
255
- <PlaceholderLine height={30} width={10} style={{marginBottom: 20}} />
256
- <PlaceholderLine height={30} width={50} style={{marginBottom: 20}} />
257
- <PlaceholderLine height={30} width={30} style={{marginBottom: 20}} />
258
- </View>
259
- ))}
260
- </Placeholder>
247
+ {[...Array(2)].map((item, i) => (
248
+ <Placeholder key={i} style={{ marginBottom: 20 }} Animation={Fade}>
249
+ <PlaceholderLine height={40} style={{ flex: 1, marginTop: 10 }} />
250
+ {[...Array(3)].map((item, i) => (
251
+ <View key={i} style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
252
+ <PlaceholderLine height={30} width={10} style={{ marginBottom: 20 }} />
253
+ <PlaceholderLine height={30} width={50} style={{ marginBottom: 20 }} />
254
+ <PlaceholderLine height={30} width={30} style={{ marginBottom: 20 }} />
255
+ </View>
256
+ ))}
257
+ </Placeholder>
261
258
  ))}
262
259
  </>
263
260
  ) : (
@@ -279,7 +276,7 @@ export const ProductOptionsUI = (props: any) => {
279
276
  </SectionTitle>
280
277
  <WrapperIngredients
281
278
  style={{ backgroundColor: isSoldOut || maxProductQuantity <= 0 ? 'hsl(0, 0%, 72%)' : theme.colors.white }}
282
- hidden={!openIngredient}
279
+ hidden={!openIngredient}
283
280
  >
284
281
  {product?.ingredients.map((ingredient: any) => (
285
282
  <ProductIngredient
@@ -319,7 +316,7 @@ export const ProductOptionsUI = (props: any) => {
319
316
  state={currentState}
320
317
  disabled={isSoldOut || maxProductQuantity <= 0}
321
318
  />
322
- ): null
319
+ ) : null
323
320
  })
324
321
  }
325
322
  </WrapperSubOption>