ordering-ui-react-native 0.12.52 → 0.12.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/src/components/Cart/index.tsx +50 -16
  3. package/src/components/OrderDetails/index.tsx +8 -0
  4. package/src/components/OrderSummary/index.tsx +38 -3
  5. package/src/layouts/Container.tsx +1 -1
  6. package/themes/business/src/components/GoogleMap/index.tsx +78 -4
  7. package/themes/business/src/components/OrderDetails/Business.tsx +11 -3
  8. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +11 -9
  9. package/themes/business/src/layouts/Container.tsx +3 -1
  10. package/themes/doordash/src/components/Cart/index.tsx +36 -2
  11. package/themes/doordash/src/components/OrderDetails/index.tsx +8 -0
  12. package/themes/doordash/src/components/OrderSummary/index.tsx +36 -3
  13. package/themes/doordash/src/layouts/Container.tsx +1 -1
  14. package/themes/franchises/src/components/Cart/index.tsx +257 -223
  15. package/themes/franchises/src/components/OrderDetails/index.tsx +723 -715
  16. package/themes/franchises/src/components/OrderSummary/index.tsx +188 -154
  17. package/themes/franchises/src/layouts/Container.tsx +1 -1
  18. package/themes/instacart/src/components/Cart/index.tsx +37 -3
  19. package/themes/instacart/src/components/OrderDetails/index.tsx +8 -0
  20. package/themes/instacart/src/components/OrderSummary/index.tsx +37 -4
  21. package/themes/instacart/src/layouts/Container.tsx +1 -1
  22. package/themes/kiosk/src/layouts/Container.tsx +2 -1
  23. package/themes/original/src/components/Cart/index.tsx +268 -234
  24. package/themes/original/src/components/OrderDetails/index.tsx +723 -715
  25. package/themes/original/src/components/OrderSummary/index.tsx +37 -3
  26. package/themes/original/src/layouts/Container.tsx +1 -1
  27. package/themes/single-business/src/components/Cart/index.tsx +1 -1
  28. package/themes/single-business/src/components/PhoneInputNumber/index.tsx +103 -112
  29. package/themes/single-business/src/components/UserDetails/index.tsx +107 -111
  30. package/themes/single-business/src/components/UserDetails/styles.tsx +3 -8
  31. package/themes/single-business/src/components/UserFormDetails/index.tsx +279 -326
  32. package/themes/single-business/src/components/UserFormDetails/styles.tsx +7 -5
  33. package/themes/single-business/src/layouts/Container.tsx +1 -1
  34. package/themes/uber-eats/src/components/Cart/index.tsx +37 -3
  35. package/themes/uber-eats/src/components/OrderDetails/index.tsx +8 -0
  36. package/themes/uber-eats/src/components/OrderSummary/index.tsx +40 -6
  37. package/themes/uber-eats/src/layouts/Container.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.52",
3
+ "version": "0.12.56",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -16,14 +16,14 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
16
16
  import { BusinessItemAccordion } from '../BusinessItemAccordion';
17
17
  import { CouponControl } from '../CouponControl';
18
18
 
19
- import { OButton, OModal, OText } from '../shared';
19
+ import { OButton, OModal, OText, OInput } from '../shared';
20
20
  import { ProductForm } from '../ProductForm';
21
21
  import { UpsellingProducts } from '../UpsellingProducts';
22
22
  import { verifyDecimals } from '../../utils';
23
23
  import { useTheme } from 'styled-components/native';
24
24
  import AntIcon from 'react-native-vector-icons/AntDesign'
25
25
  import { TaxInformation } from '../TaxInformation';
26
- import { TouchableOpacity } from 'react-native';
26
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
27
27
 
28
28
  const CartUI = (props: any) => {
29
29
  const {
@@ -35,6 +35,8 @@ const CartUI = (props: any) => {
35
35
  removeProduct,
36
36
  handleCartOpen,
37
37
  setIsCartsLoading,
38
+ handleChangeComment,
39
+ commentState
38
40
  } = props
39
41
 
40
42
  const theme = useTheme()
@@ -180,19 +182,19 @@ const CartUI = (props: any) => {
180
182
  ))
181
183
  }
182
184
  {
183
- cart?.fees?.length > 0 && cart?.fees?.filter((fee : any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
184
- <OSTable key={fee?.id}>
185
- <OSRow>
186
- <OText numberOfLines={1}>
187
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
188
- ({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
189
- </OText>
190
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })} >
191
- <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
192
- </TouchableOpacity>
193
- </OSRow>
194
- <OText>{parsePrice(fee?.summary?.fixed + fee?.summary?.percentage || 0)}</OText>
195
- </OSTable>
185
+ cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
186
+ <OSTable key={fee?.id}>
187
+ <OSRow>
188
+ <OText numberOfLines={1}>
189
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
190
+ ({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
191
+ </OText>
192
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })} >
193
+ <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
194
+ </TouchableOpacity>
195
+ </OSRow>
196
+ <OText>{parsePrice(fee?.summary?.fixed + fee?.summary?.percentage || 0)}</OText>
197
+ </OSTable>
196
198
  ))
197
199
  }
198
200
  {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
@@ -235,6 +237,38 @@ const CartUI = (props: any) => {
235
237
  </OText>
236
238
  </OSTable>
237
239
  </OSTotal>
240
+ {cart?.status !== 2 && (
241
+ <OSTable>
242
+ <View style={{ width: '100%', marginTop: 20 }}>
243
+ <OText>{t('COMMENTS', 'Comments')}</OText>
244
+ <View style={{ flex: 1, width: '100%' }}>
245
+ <OInput
246
+ value={cart?.comment}
247
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
248
+ onChange={(value: string) => handleChangeComment(value)}
249
+ style={{
250
+ alignItems: 'flex-start',
251
+ width: '100%',
252
+ height: 100,
253
+ borderColor: theme.colors.textSecondary,
254
+ paddingRight: 50,
255
+ marginTop: 10
256
+ }}
257
+ multiline
258
+ />
259
+ {commentState?.loading && (
260
+ <View style={{ position: 'absolute', right: 20 }}>
261
+ <ActivityIndicator
262
+ size='large'
263
+ style={{ height: 100 }}
264
+ color={theme.colors.primary}
265
+ />
266
+ </View>
267
+ )}
268
+ </View>
269
+ </View>
270
+ </OSTable>
271
+ )}
238
272
  </OSBill>
239
273
  )}
240
274
  {cart?.valid_products && (
@@ -294,7 +328,7 @@ const CartUI = (props: any) => {
294
328
  onClose={() => setOpenTaxModal({ open: false, data: null })}
295
329
  entireModal
296
330
  >
297
- <TaxInformation data={openTaxModal.data} products={cart.products} />
331
+ <TaxInformation data={openTaxModal.data} products={cart?.products} />
298
332
  </OModal>
299
333
  </CContainer>
300
334
  )
@@ -527,6 +527,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
527
527
  </OText>
528
528
  </Table>
529
529
  </Total>
530
+ {order?.comment && (
531
+ <Table>
532
+ <OText style={{flex: 1}}>{t('COMMENT', 'Comment')}</OText>
533
+ <OText style={{maxWidth: '70%'}}>
534
+ {order?.comment}
535
+ </OText>
536
+ </Table>
537
+ )}
530
538
  {
531
539
  (
532
540
  parseInt(order?.status) === 1 ||
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { TouchableOpacity, View } from 'react-native'
2
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native'
3
3
  import {
4
4
  Cart,
5
5
  useOrder,
@@ -19,12 +19,13 @@ import {
19
19
 
20
20
  import { ProductItemAccordion } from '../ProductItemAccordion';
21
21
  import { CouponControl } from '../CouponControl';
22
- import { OModal, OText } from '../shared';
22
+ import { OInput, OModal, OText } from '../shared';
23
23
  import { ProductForm } from '../ProductForm';
24
24
  import { verifyDecimals } from '../../utils';
25
25
  import { useTheme } from 'styled-components/native';
26
26
  import { TaxInformation } from '../TaxInformation';
27
27
  import AntIcon from 'react-native-vector-icons/AntDesign'
28
+
28
29
  const OrderSummaryUI = (props: any) => {
29
30
  const {
30
31
  cart,
@@ -33,7 +34,9 @@ const OrderSummaryUI = (props: any) => {
33
34
  offsetDisabled,
34
35
  removeProduct,
35
36
  isCartPending,
36
- isFromCheckout
37
+ isFromCheckout,
38
+ commentState,
39
+ handleChangeComment
37
40
  } = props;
38
41
 
39
42
  const theme = useTheme();
@@ -186,6 +189,38 @@ const OrderSummaryUI = (props: any) => {
186
189
  </OSTable>
187
190
  </View>
188
191
  )}
192
+ {cart?.status !== 2 && (
193
+ <OSTable>
194
+ <View style={{ width: '100%', marginTop: 20 }}>
195
+ <OText>{t('COMMENTS', 'Comments')}</OText>
196
+ <View style={{ flex: 1, width: '100%' }}>
197
+ <OInput
198
+ value={cart?.comment}
199
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
200
+ onChange={(value: string) => handleChangeComment(value)}
201
+ style={{
202
+ alignItems: 'flex-start',
203
+ width: '100%',
204
+ height: 100,
205
+ borderColor: theme.colors.textSecondary,
206
+ paddingRight: 50,
207
+ marginTop: 10
208
+ }}
209
+ multiline
210
+ />
211
+ {commentState?.loading && (
212
+ <View style={{ position: 'absolute', right: 20 }}>
213
+ <ActivityIndicator
214
+ size='large'
215
+ style={{ height: 100 }}
216
+ color={theme.colors.primary}
217
+ />
218
+ </View>
219
+ )}
220
+ </View>
221
+ </View>
222
+ </OSTable>
223
+ )}
189
224
  </OSBill>
190
225
  )}
191
226
  <OModal
@@ -19,7 +19,7 @@ const SafeAreaStyled = styled.SafeAreaView`
19
19
  export const Container = (props: any) => {
20
20
  return (
21
21
  <SafeAreaStyled>
22
- <ContainerStyled nopadding={props.nopadding} keyboardShouldPersistTaps='handled'>
22
+ <ContainerStyled ref={props?.forwardRef} nopadding={props.nopadding} keyboardShouldPersistTaps='handled'>
23
23
  {props.children}
24
24
  </ContainerStyled>
25
25
  </SafeAreaStyled>
@@ -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',
@@ -40,7 +40,6 @@ export const OrderContentComponent = (props: OrderContent) => {
40
40
  const [{ parsePrice, parseNumber }] = useUtils();
41
41
  const [{ configs }] = useConfig();
42
42
  const [openReviewModal, setOpenReviewModal] = useState(false)
43
- const [isCustomerReviewed, setIsCustomerReviewed] = useState(false)
44
43
 
45
44
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
46
45
 
@@ -65,11 +64,6 @@ export const OrderContentComponent = (props: OrderContent) => {
65
64
  }
66
65
  })
67
66
 
68
- const handleSuccessReviewed = () => {
69
- setOpenReviewModal(false)
70
- setIsCustomerReviewed(true)
71
- }
72
-
73
67
  return (
74
68
  <OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
75
69
  {isOrderGroup && (
@@ -265,7 +259,7 @@ export const OrderContentComponent = (props: OrderContent) => {
265
259
  {order?.customer?.zipcode}
266
260
  </OText>
267
261
  )}
268
- {/* {!order?.user_review && pastOrderStatuses.includes(order?.status) && !isCustomerReviewed && (
262
+ {!order?.user_review && pastOrderStatuses.includes(order?.status) && (
269
263
  <OButton
270
264
  style={styles.btnReview}
271
265
  textStyle={{ color: theme.colors.white }}
@@ -273,7 +267,7 @@ export const OrderContentComponent = (props: OrderContent) => {
273
267
  imgRightSrc={false}
274
268
  onClick={() => setOpenReviewModal(true)}
275
269
  />
276
- )} */}
270
+ )}
277
271
  </OrderCustomer>
278
272
 
279
273
  <OrderProducts>
@@ -435,6 +429,14 @@ export const OrderContentComponent = (props: OrderContent) => {
435
429
  </OText>
436
430
  </Table>
437
431
  </Total>
432
+ {order?.comment && (
433
+ <Table>
434
+ <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
435
+ <OText style={{ maxWidth: '70%' }}>
436
+ {order?.comment}
437
+ </OText>
438
+ </Table>
439
+ )}
438
440
  </OrderBill >
439
441
  <OModal
440
442
  open={openReviewModal}
@@ -445,7 +447,7 @@ export const OrderContentComponent = (props: OrderContent) => {
445
447
  <ReviewCustomer
446
448
  order={order}
447
449
  closeModal={() => setOpenReviewModal(false)}
448
- onClose={() => handleSuccessReviewed()}
450
+ onClose={() => setOpenReviewModal(false)}
449
451
  />
450
452
  </OModal>
451
453
  </OrderContent>
@@ -46,7 +46,9 @@ export const Container = (props: any) => {
46
46
  <ContainerStyled
47
47
  contentContainerStyle={props.style}
48
48
  keyboardShouldPersistTaps="handled"
49
- orientation={orientation}>
49
+ orientation={orientation}
50
+ ref={props?.forwardRef}
51
+ >
50
52
  {props.children}
51
53
  </ContainerStyled>
52
54
  </SafeAreaStyled>
@@ -16,12 +16,12 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
16
16
  import { BusinessItemAccordion } from '../BusinessItemAccordion';
17
17
  import { CouponControl } from '../CouponControl';
18
18
 
19
- import { OButton, OModal, OText } from '../shared';
19
+ import { OButton, OInput, OModal, OText } from '../shared';
20
20
  import { useTheme } from 'styled-components/native';
21
21
  import { ProductForm } from '../ProductForm';
22
22
  import { UpsellingProducts } from '../UpsellingProducts';
23
23
  import { verifyDecimals } from '../../utils';
24
- import { Platform } from 'react-native';
24
+ import { ActivityIndicator, Platform, View } from 'react-native';
25
25
  import { TaxInformation } from '../TaxInformation';
26
26
  import { TouchableOpacity } from 'react-native';
27
27
  import AntIcon from 'react-native-vector-icons/AntDesign'
@@ -36,6 +36,8 @@ const CartUI = (props: any) => {
36
36
  removeProduct,
37
37
  handleCartOpen,
38
38
  setIsCartsLoading,
39
+ handleChangeComment,
40
+ commentState
39
41
  // isFromCart
40
42
  } = props
41
43
  const theme = useTheme();
@@ -222,6 +224,38 @@ const CartUI = (props: any) => {
222
224
  </OText>
223
225
  </OSTable>
224
226
  </OSTotal>
227
+ {cart?.status !== 2 && (
228
+ <OSTable>
229
+ <View style={{ width: '100%', marginTop: 20 }}>
230
+ <OText>{t('COMMENTS', 'Comments')}</OText>
231
+ <View style={{ flex: 1, width: '100%' }}>
232
+ <OInput
233
+ value={cart?.comment}
234
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
235
+ onChange={(value: string) => handleChangeComment(value)}
236
+ style={{
237
+ alignItems: 'flex-start',
238
+ width: '100%',
239
+ height: 100,
240
+ borderColor: theme.colors.textSecondary,
241
+ paddingRight: 50,
242
+ marginTop: 10
243
+ }}
244
+ multiline
245
+ />
246
+ {commentState?.loading && (
247
+ <View style={{ position: 'absolute', right: 20 }}>
248
+ <ActivityIndicator
249
+ size='large'
250
+ color={theme.colors.primary}
251
+ style={{ height: 100 }}
252
+ />
253
+ </View>
254
+ )}
255
+ </View>
256
+ </View>
257
+ </OSTable>
258
+ )}
225
259
  </OSBill>
226
260
  )}
227
261
  {cart?.valid_products && (
@@ -445,6 +445,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
445
445
  <OText size={12} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{parsePrice(order?.summary?.total || order?.total)}</OText>
446
446
  </Table>
447
447
  </Total>
448
+ {order?.comment && (
449
+ <Table>
450
+ <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
451
+ <OText style={{ maxWidth: '70%' }}>
452
+ {order?.comment}
453
+ </OText>
454
+ </Table>
455
+ )}
448
456
  </OrderBill>
449
457
  </OrderContent>
450
458
  </>
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { TextStyle, TouchableOpacity, View } from 'react-native'
2
+ import { ActivityIndicator, TextStyle, TouchableOpacity, View } from 'react-native'
3
3
  import {
4
4
  Cart,
5
5
  useOrder,
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  import { ProductItemAccordion } from '../ProductItemAccordion';
21
21
  import { CouponControl } from '../CouponControl';
22
- import { OModal, OText } from '../shared';
22
+ import { OInput, OModal, OText } from '../shared';
23
23
  import { useTheme } from 'styled-components/native';
24
24
  import { ProductForm } from '../ProductForm';
25
25
  import { verifyDecimals } from '../../utils';
@@ -40,6 +40,8 @@ const OrderSummaryUI = (props: any) => {
40
40
  title,
41
41
  paddingH,
42
42
  isMini,
43
+ commentState,
44
+ handleChangeComment
43
45
  } = props;
44
46
 
45
47
  const theme = useTheme();
@@ -235,7 +237,38 @@ const OrderSummaryUI = (props: any) => {
235
237
  )}
236
238
  </View>
237
239
  ) : null}
238
-
240
+ {cart?.status !== 2 && (
241
+ <OSTable>
242
+ <View style={{ width: '100%', marginTop: 20 }}>
243
+ <OText>{t('COMMENTS', 'Comments')}</OText>
244
+ <View style={{ flex: 1, width: '100%' }}>
245
+ <OInput
246
+ value={cart?.comment}
247
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
248
+ onChange={(value: string) => handleChangeComment(value)}
249
+ style={{
250
+ alignItems: 'flex-start',
251
+ width: '100%',
252
+ height: 100,
253
+ borderColor: theme.colors.textSecondary,
254
+ paddingRight: 50,
255
+ marginTop: 10
256
+ }}
257
+ multiline
258
+ />
259
+ {commentState?.loading && (
260
+ <View style={{ position: 'absolute', right: 20 }}>
261
+ <ActivityIndicator
262
+ size='large'
263
+ style={{ height: 100 }}
264
+ color={theme.colors.primary}
265
+ />
266
+ </View>
267
+ )}
268
+ </View>
269
+ </View>
270
+ </OSTable>
271
+ )}
239
272
  </OSBill>
240
273
  )}
241
274
  <OModal
@@ -18,7 +18,7 @@ const SafeAreaStyled = styled.SafeAreaView`
18
18
  export const Container = (props: any) => {
19
19
  return (
20
20
  <SafeAreaStyled>
21
- <ContainerStyled style={props?.style} {...props} keyboardShouldPersistTaps='handled'>
21
+ <ContainerStyled ref={props?.forwardRef} style={props?.style} {...props} keyboardShouldPersistTaps='handled'>
22
22
  {props.children}
23
23
  </ContainerStyled>
24
24
  </SafeAreaStyled>