ordering-ui-react-native 0.21.59-test → 0.22.43-test

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 (22) hide show
  1. package/package.json +2 -3
  2. package/themes/business/index.tsx +0 -5
  3. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +5 -1
  4. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  5. package/themes/business/src/components/OrderDetails/Delivery.tsx +11 -6
  6. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  7. package/themes/business/src/components/OrderSummary/index.tsx +3 -10
  8. package/themes/business/src/components/OrdersOption/index.tsx +2 -0
  9. package/themes/business/src/components/PreviousOrders/OrderList.tsx +17 -12
  10. package/themes/business/src/components/PreviousOrders/index.tsx +77 -65
  11. package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
  12. package/themes/original/src/components/BusinessProductsListing/index.tsx +1 -0
  13. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  14. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  15. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +66 -3
  16. package/themes/original/src/components/NavBar/index.tsx +0 -1
  17. package/themes/original/src/components/UserFormDetails/index.tsx +35 -2
  18. package/themes/original/src/components/UserFormDetails/styles.tsx +31 -1
  19. package/themes/original/src/components/Wallets/index.tsx +1 -0
  20. package/themes/original/src/components/Wallets/styles.tsx +0 -1
  21. package/themes/business/src/components/StarPrinter/SearchPrinter.tsx +0 -106
  22. package/themes/business/src/components/StarPrinter/index.tsx +0 -235
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.21.59-test",
3
+ "version": "0.22.43-test",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -45,7 +45,6 @@
45
45
  "@react-native-firebase/analytics": "^12.9.3",
46
46
  "@react-native-firebase/app": "^12.9.3",
47
47
  "@react-native-google-signin/google-signin": "^7.0.1",
48
- "@react-native-picker/picker": "^2.4.10",
49
48
  "@react-navigation/drawer": "^5.10.2",
50
49
  "@react-navigation/material-bottom-tabs": "^5.3.14",
51
50
  "@react-navigation/native": "^5.7.6",
@@ -79,6 +78,7 @@
79
78
  "react-native-credit-card-input": "^0.4.1",
80
79
  "react-native-device-info": "^8.7.1",
81
80
  "react-native-document-picker": "^5.2.0",
81
+ "react-datepicker": "^4.12.0",
82
82
  "react-native-elements": "^3.0.0-alpha.1",
83
83
  "react-native-fast-image": "^8.3.3",
84
84
  "react-native-fbsdk-next": "^7.0.1",
@@ -111,7 +111,6 @@
111
111
  "react-native-signature-canvas": "^4.3.0",
112
112
  "react-native-snap-carousel": "^3.9.1",
113
113
  "react-native-sound": "^0.11.1",
114
- "react-native-star-io10": "^1.1.0",
115
114
  "react-native-swipe-gestures": "^1.0.5",
116
115
  "react-native-swiper": "^1.6.0",
117
116
  "react-native-tracking-transparency": "^0.1.1",
@@ -42,8 +42,6 @@ import { NewOrderNotification } from './src/components/NewOrderNotification';
42
42
  import { DriverSchedule } from './src/components/DriverSchedule';
43
43
  import { ScheduleBlocked } from './src/components/ScheduleBlocked';
44
44
  import { OrderDetailsLogistic } from './src/components/OrderDetailsLogistic'
45
- import HandleStarPrinter from './src/components/StarPrinter/';
46
- import SearchStarPrinter from './src/components/StarPrinter/SearchPrinter';
47
45
  //OComponents
48
46
  import {
49
47
  OText,
@@ -132,7 +130,4 @@ export {
132
130
  useLocation,
133
131
  // providers
134
132
  StoreMethods,
135
- //printer
136
- HandleStarPrinter,
137
- SearchStarPrinter,
138
133
  };
@@ -307,7 +307,11 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
307
307
  }, [])
308
308
 
309
309
  return (
310
- <KeyboardAvoidingView style={{ flex: 1 }}>
310
+ <KeyboardAvoidingView
311
+ enabled
312
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
313
+ style={{ flex: 1 }}
314
+ >
311
315
  <View style={styles.parent}>
312
316
  <View style={styles.upper}>
313
317
  <TopActions>
@@ -25,6 +25,7 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
25
25
  secondButton,
26
26
  widthButton,
27
27
  isPadding,
28
+ isHideRejectButtons
28
29
  } = props;
29
30
 
30
31
  const theme = useTheme();
@@ -61,39 +62,41 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
61
62
  width: '100%',
62
63
  justifyContent: 'space-between',
63
64
  }}>
64
- <Button
65
- secondButton={secondButton}
66
- style={[
67
- {
68
- borderWidth: colorTxt1 ? 1 : 0,
69
- borderColor: colorTxt1 ? colorTxt1 : null,
70
- },
71
- secondButton
72
- ? { backgroundColor: firstColorCustom || styles.primaryBtn }
73
- : color
74
- ? { backgroundColor: color }
75
- : styles.primaryBtn,
76
- ,
77
- { width: widthButton },
78
- ]}
79
- onPress={firstButtonClick}
80
- disabled={disabled}>
81
- <OText color={theme.colors.white} size={16} mLeft={20}>
82
- {btnLeftValueShow ? btnLeftValue : ''}
83
- </OText>
65
+ {!isHideRejectButtons && (
66
+ <Button
67
+ secondButton={secondButton}
68
+ style={[
69
+ {
70
+ borderWidth: colorTxt1 ? 1 : 0,
71
+ borderColor: colorTxt1 ? colorTxt1 : null,
72
+ },
73
+ secondButton
74
+ ? { backgroundColor: firstColorCustom || styles.primaryBtn }
75
+ : color
76
+ ? { backgroundColor: color }
77
+ : styles.primaryBtn,
78
+ ,
79
+ { width: widthButton },
80
+ ]}
81
+ onPress={firstButtonClick}
82
+ disabled={disabled}>
83
+ <OText color={theme.colors.white} size={16} mLeft={20}>
84
+ {btnLeftValueShow ? btnLeftValue : ''}
85
+ </OText>
84
86
 
85
- <OText
86
- style={styles.btnTextStyle}
87
- color={colorTxt1 ? colorTxt1 : theme.colors.white}
88
- numberOfLines={2}
89
- adjustsFontSizeToFit>
90
- {btnText}
91
- </OText>
87
+ <OText
88
+ style={styles.btnTextStyle}
89
+ color={colorTxt1 ? colorTxt1 : theme.colors.white}
90
+ numberOfLines={2}
91
+ adjustsFontSizeToFit>
92
+ {btnText}
93
+ </OText>
92
94
 
93
- <OText color={theme.colors.white} size={16} mRight={20}>
94
- {btnRightValueShow ? btnRightValue : ''}
95
- </OText>
96
- </Button>
95
+ <OText color={theme.colors.white} size={16} mRight={20}>
96
+ {btnRightValueShow ? btnRightValue : ''}
97
+ </OText>
98
+ </Button>
99
+ )}
97
100
 
98
101
  {secondButton && (
99
102
  <Button
@@ -61,9 +61,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
61
61
  const [, { showToast }] = useToast();
62
62
  const [{ parsePrice, parseNumber }] = useUtils();
63
63
  const [{ configs }] = useConfig();
64
+
64
65
  const { order } = props.order
65
66
 
66
67
  const isAllowedDriverRejectOrder = configs?.allow_driver_reject_order?.value === '1'
68
+ const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
67
69
  const theme = useTheme();
68
70
  const [, t] = useLanguage();
69
71
  const [session] = useSession();
@@ -88,9 +90,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
88
90
  const logisticOrderStatus = [4, 6, 7]
89
91
 
90
92
  const showFloatButtonsPickUp: any = {
91
- 8: true,
93
+ 8: !isHideRejectButtons,
92
94
  3: true,
93
- 18: true,
95
+ 18: !isHideRejectButtons,
94
96
  };
95
97
 
96
98
  const showFloatButtonsAcceptOrReject: any = {
@@ -482,7 +484,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
482
484
  />
483
485
  </Pickup>
484
486
  )}
485
- {order?.status === 3 && order?.delivery_type === 1 && (
487
+ {order?.status === 3 && order?.delivery_type === 1 && !isHideRejectButtons && (
486
488
  <View style={{ paddingVertical: 20, marginBottom: 20 }}>
487
489
  <OButton
488
490
  style={styles.btnPickUp}
@@ -577,7 +579,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
577
579
  secondButton={true}
578
580
  firstColorCustom={theme.colors.red}
579
581
  secondColorCustom={theme.colors.green}
580
- widthButton={'45%'}
582
+ widthButton={isHideRejectButtons ? '100%': '45%'}
583
+ isHideRejectButtons={isHideRejectButtons}
581
584
  />
582
585
  )}
583
586
  {(validStatusComplete.includes(order?.status)) && (
@@ -596,7 +599,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
596
599
  secondButton={true}
597
600
  firstColorCustom={theme.colors.red}
598
601
  secondColorCustom={theme.colors.green}
599
- widthButton={'45%'}
602
+ widthButton={isHideRejectButtons ? '100%': '45%'}
603
+ isHideRejectButtons={isHideRejectButtons}
600
604
  />
601
605
  </>
602
606
  )}
@@ -610,7 +614,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
610
614
  secondButton={true}
611
615
  firstColorCustom={theme.colors.red}
612
616
  secondColorCustom={theme.colors.green}
613
- widthButton={'45%'}
617
+ widthButton={isHideRejectButtons ? '100%': '45%'}
618
+ isHideRejectButtons={isHideRejectButtons}
614
619
  />
615
620
  )}
616
621
  </>
@@ -10,6 +10,7 @@ import {
10
10
  useLanguage,
11
11
  OrderDetails as OrderDetailsConTableoller,
12
12
  useSession,
13
+ useConfig
13
14
  } from 'ordering-components/native';
14
15
 
15
16
  //Components
@@ -34,6 +35,8 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
34
35
  const theme = useTheme();
35
36
  const [, t] = useLanguage();
36
37
  const [session] = useSession();
38
+ const [{ configs }] = useConfig();
39
+
37
40
  const [alertState, setAlertState] = useState<{
38
41
  open: boolean;
39
42
  content: Array<string>;
@@ -41,6 +44,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
41
44
  }>({ open: false, content: [], key: null });
42
45
 
43
46
  const logisticOrderStatus = [4, 6, 7]
47
+ const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
44
48
 
45
49
  const showFloatButtonsAcceptOrReject: any = {
46
50
  0: true,
@@ -166,7 +170,8 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
166
170
  secondButton={true}
167
171
  firstColorCustom={theme.colors.red}
168
172
  secondColorCustom={theme.colors.green}
169
- widthButton={'45%'}
173
+ widthButton={isHideRejectButtons ? '100%': '45%'}
174
+ isHideRejectButtons={isHideRejectButtons}
170
175
  />
171
176
  )}
172
177
  </>
@@ -1,8 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { OText, OIconButton } from '../shared';
3
- import {
4
- StyleSheet, View, Platform, Alert
5
- } from 'react-native';
3
+ import { StyleSheet, View, Platform, Alert } from 'react-native';
6
4
  import {
7
5
  Content,
8
6
  OrderCustomer,
@@ -22,8 +20,8 @@ import { FloatingButton } from '../FloatingButton';
22
20
  import RNHTMLtoPDF from 'react-native-html-to-pdf';
23
21
  import RNPrint from 'react-native-print';
24
22
  import { useTheme } from 'styled-components/native';
25
- import { ProductItemAccordion } from '../ProductItemAccordion';
26
23
 
24
+ import { ProductItemAccordion } from '../ProductItemAccordion';
27
25
 
28
26
  export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermission, getPermissions, isGrantedPermissions, checkBluetoothPermission }: any) => {
29
27
  const handleArrowBack: any = () => {
@@ -36,7 +34,6 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
36
34
  selectedPrinter: { url: undefined },
37
35
  });
38
36
 
39
-
40
37
  const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
41
38
  if (name !== 'No') {
42
39
  const pos = position && position !== 'whole' ? `(${t(position.toUpperCase(), position)})` : '';
@@ -343,10 +340,6 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
343
340
  }
344
341
  };
345
342
 
346
- const openPrint = () => {
347
- navigation.navigate('HandleStarPrinter')
348
- }
349
-
350
343
  return (
351
344
  <>
352
345
  <Content>
@@ -686,7 +679,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
686
679
 
687
680
  <View style={{ marginBottom: 0 }}>
688
681
  <FloatingButton
689
- firstButtonClick={() => openPrint()}
682
+ firstButtonClick={() => handlePrint()}
690
683
  btnText={t('PRINT', 'Print')}
691
684
  color={theme.colors.green}
692
685
  widthButton={'100%'}
@@ -608,6 +608,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
608
608
  orderTitle={props.orderDetailsProps?.orderTitle}
609
609
  handleChangeOrderStatus={handleChangeOrderStatus}
610
610
  handleSendCustomerReview={handleSendCustomerReview}
611
+ isBusinessApp={isBusinessApp}
611
612
  />
612
613
  )}
613
614
  {!logisticOrders?.error?.length &&
@@ -618,6 +619,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
618
619
  onNavigationRedirect={onNavigationRedirect}
619
620
  getOrderStatus={getOrderStatus}
620
621
  handleClickLogisticOrder={handleClickLogisticOrder}
622
+ isBusinessApp={isBusinessApp}
621
623
  isLogisticOrder
622
624
  />
623
625
  )
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import { View } from 'react-native'
3
3
  import { useTheme } from 'styled-components/native'
4
4
  import { OButton } from '../shared';
5
- import { useLanguage } from 'ordering-components/native'
5
+ import { useLanguage, useConfig } from 'ordering-components/native'
6
6
  import { OrderItem } from './OrderItem';
7
7
  import { AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
8
8
 
@@ -28,6 +28,9 @@ export const OrdersList = React.memo((props: any) => {
28
28
 
29
29
  const theme = useTheme()
30
30
  const [, t] = useLanguage()
31
+ const [{ configs }] = useConfig();
32
+
33
+ const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
31
34
 
32
35
  return (
33
36
  <View
@@ -59,16 +62,18 @@ export const OrdersList = React.memo((props: any) => {
59
62
  />
60
63
  ) : (
61
64
  <>
62
- <OButton
63
- text={t('REJECT', 'Reject')}
64
- onClick={() => handleClickLogisticOrder(2, _order?.id)}
65
- bgColor={theme.colors.red}
66
- borderColor={theme.colors.red}
67
- imgRightSrc={null}
68
- style={{ borderRadius: 7, height: 40 }}
69
- parentStyle={{ width: '45%' }}
70
- textStyle={{ color: theme.colors.white }}
71
- />
65
+ {!isHideRejectButtons && (
66
+ <OButton
67
+ text={t('REJECT', 'Reject')}
68
+ onClick={() => handleClickLogisticOrder(2, _order?.id)}
69
+ bgColor={theme.colors.red}
70
+ borderColor={theme.colors.red}
71
+ imgRightSrc={null}
72
+ style={{ borderRadius: 7, height: 40 }}
73
+ parentStyle={{ width: '45%' }}
74
+ textStyle={{ color: theme.colors.white }}
75
+ />
76
+ )}
72
77
  <OButton
73
78
  text={t('ACCEPT', 'Accept')}
74
79
  onClick={() => handleClickLogisticOrder(1, _order?.id)}
@@ -76,7 +81,7 @@ export const OrdersList = React.memo((props: any) => {
76
81
  borderColor={theme.colors.green}
77
82
  imgRightSrc={null}
78
83
  style={{ borderRadius: 7, height: 40 }}
79
- parentStyle={{ width: '45%' }}
84
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
80
85
  textStyle={{ color: theme.colors.white }}
81
86
  />
82
87
  </>
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
- import { useLanguage } from 'ordering-components/native';
4
+ import { useLanguage, useConfig } from 'ordering-components/native';
5
5
 
6
6
  import { AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
7
7
 
@@ -24,12 +24,15 @@ export const PreviousOrders = (props: any) => {
24
24
  currentTabSelected,
25
25
  currentOrdenSelected,
26
26
  handleChangeOrderStatus,
27
- handleSendCustomerReview
27
+ handleSendCustomerReview,
28
+ isBusinessApp
28
29
  } = props;
29
30
 
30
31
  let hash: any = {};
31
32
  const [, t] = useLanguage();
32
33
  const theme = useTheme();
34
+ const [{ configs }] = useConfig();
35
+
33
36
 
34
37
  // const [, setCurrentTime] = useState()
35
38
  const [openModal, setOpenModal] = useState(false)
@@ -41,6 +44,7 @@ export const PreviousOrders = (props: any) => {
41
44
  const viewMapStatus = [9, 18, 19, 23]
42
45
  const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
43
46
  const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23]
47
+ const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1' && !isBusinessApp
44
48
 
45
49
  const handlePressOrder = (order: any) => {
46
50
  if (order?.locked && isLogisticOrder) return
@@ -168,28 +172,30 @@ export const PreviousOrders = (props: any) => {
168
172
  }
169
173
  {_ordersGrouped[k][0]?.status === 0 && (
170
174
  <AcceptOrRejectOrderStyle>
171
- <OButton
172
- text={t('REJECT_ALL', 'Reject all')}
173
- bgColor={theme.colors.danger100}
174
- borderColor={theme.colors.danger100}
175
- imgRightSrc={null}
176
- style={{ borderRadius: 7, height: 40 }}
177
- parentStyle={{ width: '45%' }}
178
- textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
179
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
180
- action: 'reject',
181
- order: _ordersGrouped[k][0],
182
- ids: _ordersGrouped[k].map((o: any) => o.id),
183
- handleChangeOrderStatus
184
- })}
185
- />
175
+ {!isHideRejectButtons && (
176
+ <OButton
177
+ text={t('REJECT_ALL', 'Reject all')}
178
+ bgColor={theme.colors.danger100}
179
+ borderColor={theme.colors.danger100}
180
+ imgRightSrc={null}
181
+ style={{ borderRadius: 7, height: 40 }}
182
+ parentStyle={{ width: '45%' }}
183
+ textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
184
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
185
+ action: 'reject',
186
+ order: _ordersGrouped[k][0],
187
+ ids: _ordersGrouped[k].map((o: any) => o.id),
188
+ handleChangeOrderStatus
189
+ })}
190
+ />
191
+ )}
186
192
  <OButton
187
193
  text={t('ACCEPT_ALL', 'Accept all')}
188
194
  bgColor={theme.colors.success100}
189
195
  borderColor={theme.colors.success100}
190
196
  imgRightSrc={null}
191
197
  style={{ borderRadius: 7, height: 40 }}
192
- parentStyle={{ width: '45%' }}
198
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
193
199
  textStyle={{ color: theme.colors.success500, fontSize: 12 }}
194
200
  onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
195
201
  action: 'accept',
@@ -236,7 +242,7 @@ export const PreviousOrders = (props: any) => {
236
242
  />
237
243
  </AcceptOrRejectOrderStyle>
238
244
  )}
239
- {_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 &&
245
+ {_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 && !isHideRejectButtons &&
240
246
  (
241
247
  <AcceptOrRejectOrderStyle>
242
248
  <OButton
@@ -276,26 +282,28 @@ export const PreviousOrders = (props: any) => {
276
282
  ![1].includes(_ordersGrouped[k][0]?.delivery_type) &&
277
283
  (
278
284
  <AcceptOrRejectOrderStyle>
279
- <OButton
280
- text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
281
- bgColor={theme.colors.danger100}
282
- borderColor={theme.colors.danger100}
283
- imgRightSrc={null}
284
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
285
- parentStyle={{ width: '45%' }}
286
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
287
- onClick={() => handleChangeOrderStatus(
288
- 17,
289
- _ordersGrouped[k].map((o: any) => o.id),
290
- )}
291
- />
285
+ {!isHideRejectButtons && (
286
+ <OButton
287
+ text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
288
+ bgColor={theme.colors.danger100}
289
+ borderColor={theme.colors.danger100}
290
+ imgRightSrc={null}
291
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
292
+ parentStyle={{ width: '45%' }}
293
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
294
+ onClick={() => handleChangeOrderStatus(
295
+ 17,
296
+ _ordersGrouped[k].map((o: any) => o.id),
297
+ )}
298
+ />
299
+ )}
292
300
  <OButton
293
301
  text={t('PICKUP_COMPLETED_BY_CUSTOMER', 'Pickup completed by customer')}
294
302
  bgColor={theme.colors.success100}
295
303
  borderColor={theme.colors.success100}
296
304
  imgRightSrc={null}
297
305
  style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
298
- parentStyle={{ width: '45%' }}
306
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
299
307
  textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
300
308
  onClick={() => handleChangeOrderStatus(
301
309
  15,
@@ -324,28 +332,30 @@ export const PreviousOrders = (props: any) => {
324
332
  )}
325
333
  {!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && (
326
334
  <AcceptOrRejectOrderStyle>
327
- <OButton
328
- text={t('PICKUP_FAILED', 'Pickup failed')}
329
- bgColor={theme.colors.danger100}
330
- borderColor={theme.colors.danger100}
331
- imgRightSrc={null}
332
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
333
- parentStyle={{ width: '45%' }}
334
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
335
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
336
- action: 'pickupFailed',
337
- order: _ordersGrouped[k][0],
338
- ids: _ordersGrouped[k].map((o: any) => o.id),
339
- handleChangeOrderStatus
340
- })}
341
- />
335
+ {!isHideRejectButtons && (
336
+ <OButton
337
+ text={t('PICKUP_FAILED', 'Pickup failed')}
338
+ bgColor={theme.colors.danger100}
339
+ borderColor={theme.colors.danger100}
340
+ imgRightSrc={null}
341
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
342
+ parentStyle={{ width: '45%' }}
343
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
344
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
345
+ action: 'pickupFailed',
346
+ order: _ordersGrouped[k][0],
347
+ ids: _ordersGrouped[k].map((o: any) => o.id),
348
+ handleChangeOrderStatus
349
+ })}
350
+ />
351
+ )}
342
352
  <OButton
343
353
  text={t('PICKUP_COMPLETE', 'Pickup complete')}
344
354
  bgColor={theme.colors.success100}
345
355
  borderColor={theme.colors.success100}
346
356
  imgRightSrc={null}
347
357
  style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
348
- parentStyle={{ width: '45%' }}
358
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
349
359
  textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
350
360
  onClick={() => handleChangeOrderStatus(
351
361
  9,
@@ -356,28 +366,30 @@ export const PreviousOrders = (props: any) => {
356
366
  )}
357
367
  {!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) && (
358
368
  <AcceptOrRejectOrderStyle>
359
- <OButton
360
- text={t('DELIVERY_FAILED', 'Delivery Failed')}
361
- bgColor={theme.colors.danger100}
362
- borderColor={theme.colors.danger100}
363
- imgRightSrc={null}
364
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
365
- parentStyle={{ width: '45%' }}
366
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
367
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
368
- action: 'deliveryFailed',
369
- order: _ordersGrouped[k][0],
370
- ids: _ordersGrouped[k].map((o: any) => o.id),
371
- handleChangeOrderStatus
372
- })}
373
- />
369
+ {!isHideRejectButtons && (
370
+ <OButton
371
+ text={t('DELIVERY_FAILED', 'Delivery Failed')}
372
+ bgColor={theme.colors.danger100}
373
+ borderColor={theme.colors.danger100}
374
+ imgRightSrc={null}
375
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
376
+ parentStyle={{ width: '45%' }}
377
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
378
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
379
+ action: 'deliveryFailed',
380
+ order: _ordersGrouped[k][0],
381
+ ids: _ordersGrouped[k].map((o: any) => o.id),
382
+ handleChangeOrderStatus
383
+ })}
384
+ />
385
+ )}
374
386
  <OButton
375
387
  text={t('DELIVERY_COMPLETE', 'Delivery complete')}
376
388
  bgColor={theme.colors.success100}
377
389
  borderColor={theme.colors.success100}
378
390
  imgRightSrc={null}
379
391
  style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
380
- parentStyle={{ width: '45%' }}
392
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
381
393
  textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
382
394
  onClick={() => handleChangeOrderStatus(
383
395
  11,
@@ -106,7 +106,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
106
106
  <SingleProductCard
107
107
  key={'prod_' + product.id + `_${i}`}
108
108
  isSoldOut={product.inventoried && !product.quantity}
109
- enableIntersection={!isFiltMode}
109
+ // enableIntersection={!isFiltMode}
110
110
  product={product}
111
111
  businessId={businessId}
112
112
  categoryState={categoryState}
@@ -135,7 +135,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
135
135
  key={'feat_' + product.id + `_${i}`}
136
136
  isSoldOut={product.inventoried && !product.quantity}
137
137
  product={product}
138
- enableIntersection={!isFiltMode}
138
+ // enableIntersection={!isFiltMode}
139
139
  businessId={businessId}
140
140
  categoryState={categoryState}
141
141
  onProductClick={onProductClick}
@@ -726,6 +726,7 @@ export const BusinessProductsListing = (props: BusinessProductsListingParams) =>
726
726
  const businessProductslistingProps = {
727
727
  ...props,
728
728
  isForceSearch: Platform.OS === 'ios',
729
+ isApp: true,
729
730
  UIComponent: BusinessProductsListingUI
730
731
  }
731
732
  return (
@@ -56,7 +56,7 @@ export const GiftCardUI = React.memo((props: any) => {
56
56
  <View style={style.actionWrapper}>
57
57
  <OButton
58
58
  onClick={() => setOpenModal('purchase')}
59
- text={t('PURCHASE_GIFT_CARD', 'Purchase gift card')}
59
+ text={t('PURCHASE', 'Purchase')}
60
60
  bgColor={theme.colors.primary}
61
61
  borderColor={theme.colors.primary}
62
62
  textStyle={{ color: 'white', fontSize: 13 }}
@@ -66,7 +66,7 @@ export const GiftCardUI = React.memo((props: any) => {
66
66
 
67
67
  <OButton
68
68
  onClick={() => setOpenModal('redeem')}
69
- text={t('REDEEM_GIFT_CARD', 'Redeem gift card')}
69
+ text={t('REDEEM', 'Redeem')}
70
70
  bgColor={theme.colors.lightPrimary}
71
71
  borderColor={theme.colors.lightPrimary}
72
72
  textStyle={{ color: theme.colors.primary, fontSize: 13 }}
@@ -79,13 +79,18 @@ export const GiftCardUI = React.memo((props: any) => {
79
79
  open={openModal === 'purchase'}
80
80
  onClose={() => setOpenModal(null)}
81
81
  entireModal
82
+ customClose
82
83
  >
83
- <PurchaseGiftCard handleCustomGoToCheckout={handleCustomGoToCheckout} />
84
+ <PurchaseGiftCard
85
+ handleCustomGoToCheckout={handleCustomGoToCheckout}
86
+ onClose={() => setOpenModal(null)}
87
+ />
84
88
  </OModal>
85
89
  <OModal
86
90
  open={openModal === 'redeem'}
87
91
  onClose={() => setOpenModal(null)}
88
92
  entireModal
93
+ customClose
89
94
  >
90
95
  <RedeemGiftCard
91
96
  onClose={() => setOpenModal(null)}
@@ -3,10 +3,11 @@ import {
3
3
  useLanguage,
4
4
  PurchaseGiftCard as PurchaseGiftCardController
5
5
  } from 'ordering-components/native'
6
- import { StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native'
6
+ import { StyleSheet, View, TouchableOpacity, ScrollView, Platform } from 'react-native'
7
7
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
8
8
  import { useTheme } from 'styled-components/native';
9
9
  import { OText, OButton, OIcon } from '../../shared';
10
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
10
11
 
11
12
  import {
12
13
  Container
@@ -17,7 +18,8 @@ const PurchaseGiftCardUI = (props: any) => {
17
18
  productsListState,
18
19
  selectedProduct,
19
20
  setSelectedProduct,
20
- handleAccept
21
+ handleAccept,
22
+ onClose
21
23
  } = props
22
24
 
23
25
  const theme = useTheme()
@@ -42,7 +44,38 @@ const PurchaseGiftCardUI = (props: any) => {
42
44
 
43
45
  return (
44
46
  <Container>
45
- <OText color={theme.colors.textNormal} weight='bold' size={20} mBottom={40}>{t('PURCHASE_GIFT_CARD', 'Purchase gift card')}</OText>
47
+ <View style={{
48
+ marginBottom: 40,
49
+ marginTop: Platform.OS === 'ios' ? 30 : 50,
50
+ display: 'flex',
51
+ flexDirection: 'row',
52
+ alignItems: 'center',
53
+ }}>
54
+ <OButton
55
+ imgLeftStyle={{ width: 18 }}
56
+ imgRightSrc={null}
57
+ style={{
58
+ borderWidth: 0,
59
+ width: 26,
60
+ height: 26,
61
+ backgroundColor: '#FFF',
62
+ borderColor: '#FFF',
63
+ shadowColor: '#FFF',
64
+ paddingLeft: 0,
65
+ paddingRight: 0,
66
+ }}
67
+ onClick={onClose}
68
+ icon={AntDesignIcon}
69
+ iconProps={{
70
+ name: 'arrowleft',
71
+ size: 26,
72
+ style: {
73
+ color: theme.colors.textNormal
74
+ }
75
+ }}
76
+ />
77
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('PURCHASE_GIFT_CARD', 'Purchase gift card')}</OText>
78
+ </View>
46
79
  <OText color={theme.colors.textNormal} size={14}>{t('SELECT_ONE_OPTION', 'Select one option')}</OText>
47
80
  <ScrollView
48
81
  contentContainerStyle={{
@@ -3,9 +3,10 @@ import {
3
3
  useLanguage, useUtils, RedeemGiftCard as RedeemGiftCardController
4
4
  } from 'ordering-components/native'
5
5
  import { useForm, Controller } from 'react-hook-form'
6
- import { StyleSheet, View, Alert } from 'react-native';
6
+ import { StyleSheet, View, Alert, Platform } from 'react-native';
7
7
  import { useTheme } from 'styled-components/native';
8
8
  import { OText, OButton, OInput } from '../../shared';
9
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
9
10
 
10
11
  import {
11
12
  Container,
@@ -93,7 +94,38 @@ const RedeemGiftCardUI = (props: any) => {
93
94
  <Container>
94
95
  {!redeemedGiftCard ? (
95
96
  <View>
96
- <OText color={theme.colors.textNormal} weight='bold' size={20} mBottom={40}>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</OText>
97
+ <View style={{
98
+ marginBottom: 40,
99
+ marginTop: Platform.OS === 'ios' ? 30 : 50,
100
+ display: 'flex',
101
+ flexDirection: 'row',
102
+ alignItems: 'center',
103
+ }}>
104
+ <OButton
105
+ imgLeftStyle={{ width: 18 }}
106
+ imgRightSrc={null}
107
+ style={{
108
+ borderWidth: 0,
109
+ width: 26,
110
+ height: 26,
111
+ backgroundColor: '#FFF',
112
+ borderColor: '#FFF',
113
+ shadowColor: '#FFF',
114
+ paddingLeft: 0,
115
+ paddingRight: 0,
116
+ }}
117
+ onClick={onClose}
118
+ icon={AntDesignIcon}
119
+ iconProps={{
120
+ name: 'arrowleft',
121
+ size: 26,
122
+ style: {
123
+ color: theme.colors.textNormal
124
+ }
125
+ }}
126
+ />
127
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</OText>
128
+ </View>
97
129
  <FormController>
98
130
  <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('GIFT_CARD_CODE', 'Gift card code')}</OText>
99
131
  <Controller
@@ -156,7 +188,38 @@ const RedeemGiftCardUI = (props: any) => {
156
188
  </View>
157
189
  ) : (
158
190
  <>
159
- <OText color={theme.colors.textNormal} weight='bold' size={20} mBottom={40}>{t('GIFT_CARD', 'Gift card')}</OText>
191
+ <View style={{
192
+ marginBottom: 40,
193
+ marginTop: Platform.OS === 'ios' ? 30 : 50,
194
+ display: 'flex',
195
+ flexDirection: 'row',
196
+ alignItems: 'center',
197
+ }}>
198
+ <OButton
199
+ imgLeftStyle={{ width: 18 }}
200
+ imgRightSrc={null}
201
+ style={{
202
+ borderWidth: 0,
203
+ width: 26,
204
+ height: 26,
205
+ backgroundColor: '#FFF',
206
+ borderColor: '#FFF',
207
+ shadowColor: '#FFF',
208
+ paddingLeft: 0,
209
+ paddingRight: 0,
210
+ }}
211
+ onClick={onClose}
212
+ icon={AntDesignIcon}
213
+ iconProps={{
214
+ name: 'arrowleft',
215
+ size: 26,
216
+ style: {
217
+ color: theme.colors.textNormal
218
+ }
219
+ }}
220
+ />
221
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('GIFT_CARD', 'Gift card')}</OText>
222
+ </View>
160
223
  <View>
161
224
  <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('TYPE', 'Type')}: {redeemedGiftCard?.type}</OText>
162
225
  <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('AMOUNT', 'Amount')}: {parsePrice(redeemedGiftCard?.amount)}</OText>
@@ -92,7 +92,6 @@ const NavBar = (props: Props) => {
92
92
  <TitleWrapper style={{ ...{ paddingHorizontal: props.isVertical ? 0 : 10 }, ...props.titleWrapStyle }}>
93
93
  <OText
94
94
  size={20}
95
- lineHeight={36}
96
95
  weight={Platform.OS === 'ios' ? '600' : 'bold'}
97
96
  style={
98
97
  {
@@ -5,7 +5,7 @@ import { useTheme } from 'styled-components/native';
5
5
  import { useForm, Controller } from 'react-hook-form';
6
6
  import { SignupForm } from '../SignupForm'
7
7
 
8
- import { UDForm, UDLoader, UDWrapper, WrapperPhone } from './styles';
8
+ import { UDForm, UDLoader, UDWrapper, WrapperPhone, DateContainer } from './styles';
9
9
 
10
10
  import { OText, OButton, OInput, OModal, OIcon } from '../shared';
11
11
  import { OAlert } from '../../../../../src/components/shared'
@@ -13,6 +13,8 @@ import { OAlert } from '../../../../../src/components/shared'
13
13
  import { PhoneInputNumber } from '../PhoneInputNumber';
14
14
  import { sortInputFields } from '../../utils';
15
15
  import { ListItem } from '../UserProfile/styles';
16
+ import moment from 'moment';
17
+ import DatePicker from 'react-datepicker'
16
18
 
17
19
  export const UserFormDetailsUI = (props: any) => {
18
20
  const {
@@ -81,6 +83,7 @@ export const UserFormDetailsUI = (props: any) => {
81
83
  const [isValid, setIsValid] = useState(false)
82
84
  const [isChanged, setIsChanged] = useState(false)
83
85
  const [isModalOpen, setIsModalOpen] = useState(false)
86
+ const [birthdate, setBirthdate] = useState(null)
84
87
  const [phoneInputData, setPhoneInputData] = useState({
85
88
  error: '',
86
89
  phone: {
@@ -92,6 +95,7 @@ export const UserFormDetailsUI = (props: any) => {
92
95
 
93
96
  const isAdmin = user?.level === 0
94
97
  const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
98
+ const showInputBirthday = validationFields?.fields?.checkout?.birthdate?.enabled ?? false
95
99
 
96
100
  const handleSuccessSignup = (user: any) => {
97
101
  login({
@@ -206,6 +210,12 @@ export const UserFormDetailsUI = (props: any) => {
206
210
  handleChangeInput(countryCode, true);
207
211
  }
208
212
 
213
+ const _handleChangeDate = (date: any) => {
214
+ setBirthdate(date)
215
+ const _birthdate = moment(date).format('YYYY-MM-DD')
216
+ handleChangeInput({ target: { name: 'birthdate', value: _birthdate } })
217
+ }
218
+
209
219
  const onRemoveAccount = () => {
210
220
  setConfirm({
211
221
  open: true,
@@ -268,6 +278,14 @@ export const UserFormDetailsUI = (props: any) => {
268
278
  }
269
279
  }, [phoneInputData, configs?.verification_phone_required?.value, isChanged])
270
280
 
281
+ useEffect(() => {
282
+ if (!validationFields.loading && birthdate) {
283
+ setValue('birthdate', formState?.result?.result
284
+ ? formState?.result?.result?.birthdate
285
+ : formState?.changes?.birthdate ?? (user && user?.birthdate) ?? '')
286
+ }
287
+ }, [validationFields, birthdate])
288
+
271
289
  useEffect(() => {
272
290
  if (!requiredFields || formState?.changes?.length === 0) return
273
291
  const _isValid = requiredFields.every((key: any) => formState?.changes[key])
@@ -359,7 +377,22 @@ export const UserFormDetailsUI = (props: any) => {
359
377
  </React.Fragment>
360
378
  ),
361
379
  )}
362
-
380
+ {showInputBirthday && (
381
+ <WrapperPhone>
382
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
383
+ {t('BIRTHDATE', 'Birthdate')}
384
+ </OText>
385
+ <DateContainer>
386
+ <DatePicker
387
+ selected={birthdate ?? user?.birthdate}
388
+ placeholderText='yyyy/mm/dd'
389
+ className='date'
390
+ name='birthdate'
391
+ onChange={_handleChangeDate}
392
+ />
393
+ </DateContainer>
394
+ </WrapperPhone>
395
+ )}
363
396
  {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
364
397
  <WrapperPhone>
365
398
  <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
@@ -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 UDForm = styled.View`
4
4
  display: flex;
@@ -32,3 +32,33 @@ export const WrapperPhone = styled.View`
32
32
  border-bottom-width: 1px;
33
33
  border-bottom-color: ${(props: any) => props.theme.colors.border};
34
34
  `
35
+
36
+ export const DateContainer = styled.div`
37
+ display: flex;
38
+ align-items: center;
39
+ text-align: initial;
40
+ border-bottom: 1px solid #E9ECEF;
41
+ margin-bottom: 20px;
42
+
43
+ input {
44
+ border-radius: 20px;
45
+ width: 140px;
46
+ outline: none;
47
+ padding: 10px 15px;
48
+ border: 1px solid #E9ECEF;
49
+ }
50
+
51
+ .react-datepicker__triangle {
52
+ transform: translate(40px, 0px) !important;
53
+ }
54
+
55
+ ${(props: any) => props.theme?.rtl ? css`
56
+ span {
57
+ margin-left: 10px;
58
+ }
59
+ ` : css`
60
+ span {
61
+ margin-right: 10px;
62
+ }
63
+ `}
64
+ `
@@ -141,6 +141,7 @@ const WalletsUI = (props: any) => {
141
141
  showCall={false}
142
142
  paddingTop={10}
143
143
  btnStyle={{ paddingLeft: 0 }}
144
+ isVertical={!hideWalletsTheme}
144
145
  hideArrowLeft={!hideWalletsTheme}
145
146
  />
146
147
  {isChewLayout && !openHistory && (
@@ -1,7 +1,6 @@
1
1
  import styled from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
- padding-horizontal: 20px;
5
4
  padding-bottom: 20px;
6
5
  padding-top: ${(props: any) => props.pdng};
7
6
  `
@@ -1,106 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- View,
4
- Text,
5
- Button,
6
- FlatList,
7
- PermissionsAndroid,
8
- Platform
9
- } from 'react-native';
10
-
11
- import {
12
- InterfaceType,
13
- StarDeviceDiscoveryManager,
14
- StarDeviceDiscoveryManagerFactory,
15
- StarPrinter
16
- } from 'react-native-star-io10';
17
- import { useTheme } from 'styled-components';
18
- import { OIconButton } from '../shared';
19
-
20
- const SearchStarPrinter = ({ navigation }: any) => {
21
- let _manager: StarDeviceDiscoveryManager;
22
- const theme = useTheme();
23
-
24
- const [state, setState] = useState({
25
- bluetoothIsEnabled: true,
26
- bluetoothLeIsEnabled: true,
27
- printers: [],
28
- })
29
-
30
- const _onPressDiscoveryButton = async () => {
31
-
32
- setState({
33
- ...state,
34
- printers: [],
35
- });
36
-
37
- try {
38
- await _manager?.stopDiscovery()
39
-
40
- const interfaceTypes: Array<InterfaceType> = []
41
-
42
- if (state.bluetoothIsEnabled) {
43
- interfaceTypes.push(InterfaceType.Bluetooth);
44
- }
45
- if (state.bluetoothLeIsEnabled) {
46
- interfaceTypes.push(InterfaceType.BluetoothLE);
47
- }
48
-
49
- _manager = await StarDeviceDiscoveryManagerFactory.create(interfaceTypes);
50
- _manager.discoveryTime = 10000;
51
-
52
- _manager.onPrinterFound = (printer: StarPrinter) => {
53
- const printers = state.printers;
54
- printers.push(printer);
55
- setState({
56
- ...state,
57
- printers: printers
58
- });
59
-
60
- console.log(`Found printer: ${printer.connectionSettings.identifier}.`);
61
- };
62
-
63
- _manager.onDiscoveryFinished = () => {
64
- console.log(`Discovery finished.`);
65
- };
66
-
67
-
68
- await _manager.startDiscovery();
69
- }
70
- catch (error) {
71
- console.log(`Error: ${String(error)}`);
72
- }
73
- }
74
-
75
- const handleArrowBack = () => {
76
- navigation?.canGoBack() && navigation.goBack();
77
- };
78
-
79
- return (
80
- <View style={{ margin: 50 }}>
81
- <OIconButton
82
- icon={theme.images.general.arrow_left}
83
- iconStyle={{ width: 20, height: 20 }}
84
- borderColor={theme.colors.clear}
85
- style={{ maxWidth: 40, justifyContent: 'flex-end' }}
86
- onClick={() => handleArrowBack()}
87
- />
88
- <Text>Interface</Text>
89
-
90
- <View
91
- style={{ width: 100, marginTop: 30 }}>
92
- <Button
93
- title="Discovery"
94
- onPress={async () => await _onPressDiscoveryButton()}
95
- />
96
- </View>
97
- <FlatList
98
- style={{ marginTop: 30 }}
99
- data={state.printers}
100
- renderItem={({ item }) => <Text>{item.connectionSettings.interfaceType} : {item.connectionSettings.identifier}</Text>}
101
- keyExtractor={(item, index) => index.toString()} />
102
- </View>
103
- );
104
- };
105
-
106
- export default SearchStarPrinter;
@@ -1,235 +0,0 @@
1
- import React from 'react';
2
- import {
3
- View,
4
- Text,
5
- Button,
6
- TextInput,
7
- PermissionsAndroid,
8
- Platform
9
- } from 'react-native';
10
-
11
- import {
12
- Picker
13
- } from '@react-native-picker/picker';
14
-
15
- import {
16
- InterfaceType,
17
- StarConnectionSettings,
18
- StarXpandCommand,
19
- StarPrinter
20
- } from 'react-native-star-io10';
21
-
22
-
23
- const HandleStarPrinter = ({ navigation }) => {
24
-
25
- const [state, setState] = React.useState({
26
- interfaceType: InterfaceType.Bluetooth,
27
- identifier: '00:11:62:00:00:00',
28
- imageBase64: ''
29
- });
30
-
31
- const _onPressPrintButton = async () => {
32
- const settings = new StarConnectionSettings();
33
- settings.interfaceType = state.interfaceType;
34
- settings.identifier = state.identifier;
35
-
36
-
37
- const printer = new StarPrinter(settings);
38
-
39
- try {
40
- const builder = new StarXpandCommand.StarXpandCommandBuilder();
41
- builder.addDocument(new StarXpandCommand.DocumentBuilder()
42
- .addPrinter(new StarXpandCommand.PrinterBuilder()
43
- .actionPrintImage(new StarXpandCommand.Printer.ImageParameter("logo_01.png", 406))
44
- .styleInternationalCharacter(StarXpandCommand.Printer.InternationalCharacterType.Usa)
45
- .styleCharacterSpace(0)
46
- .styleAlignment(StarXpandCommand.Printer.Alignment.Center)
47
- .actionPrintText("Star Clothing Boutique\n" +
48
- "123 Star Road\n" +
49
- "City, State 12345\n" +
50
- "\n")
51
- .styleAlignment(StarXpandCommand.Printer.Alignment.Left)
52
- .actionPrintText("Date:MM/DD/YYYY Time:HH:MM PM\n" +
53
- "--------------------------------\n" +
54
- "\n")
55
- .actionPrintText("SKU Description Total\n" +
56
- "300678566 PLAIN T-SHIRT 10.99\n" +
57
- "300692003 BLACK DENIM 29.99\n" +
58
- "300651148 BLUE DENIM 29.99\n" +
59
- "300642980 STRIPED DRESS 49.99\n" +
60
- "300638471 BLACK BOOTS 35.99\n" +
61
- "\n" +
62
- "Subtotal 156.95\n" +
63
- "Tax 0.00\n" +
64
- "--------------------------------\n")
65
- .actionPrintText("Total ")
66
- .add(new StarXpandCommand.PrinterBuilder()
67
- .styleMagnification(new StarXpandCommand.MagnificationParameter(2, 2))
68
- .actionPrintText(" $156.95\n")
69
- )
70
- .actionPrintText("--------------------------------\n" +
71
- "\n" +
72
- "Charge\n" +
73
- "156.95\n" +
74
- "Visa XXXX-XXXX-XXXX-0123\n" +
75
- "\n")
76
- .add(new StarXpandCommand.PrinterBuilder()
77
- .styleInvert(true)
78
- .actionPrintText("Refunds and Exchanges\n")
79
- )
80
- .actionPrintText("Within ")
81
- .add(new StarXpandCommand.PrinterBuilder()
82
- .styleUnderLine(true)
83
- .actionPrintText("30 days")
84
- )
85
- .actionPrintText(" with receipt\n")
86
- .actionPrintText("And tags attached\n" +
87
- "\n")
88
- .styleAlignment(StarXpandCommand.Printer.Alignment.Center)
89
- .actionPrintBarcode(new StarXpandCommand.Printer.BarcodeParameter('0123456',
90
- StarXpandCommand.Printer.BarcodeSymbology.Jan8)
91
- .setBarDots(3)
92
- .setBarRatioLevel(StarXpandCommand.Printer.BarcodeBarRatioLevel.Level0)
93
- .setHeight(5)
94
- .setPrintHri(true))
95
- .actionFeedLine(1)
96
- .actionPrintQRCode(new StarXpandCommand.Printer.QRCodeParameter('Hello World.\n')
97
- .setModel(StarXpandCommand.Printer.QRCodeModel.Model2)
98
- .setLevel(StarXpandCommand.Printer.QRCodeLevel.L)
99
- .setCellSize(8))
100
- .actionCut(StarXpandCommand.Printer.CutType.Partial)
101
- )
102
- );
103
-
104
- const commands = await builder.getCommands();
105
-
106
- await printer.open();
107
- await printer.print(commands);
108
-
109
- console.log(`Success`);
110
- }
111
- catch (error) {
112
- console.log(`Error: ${String(error)}`);
113
- }
114
- finally {
115
- await printer.close();
116
- await printer.dispose();
117
- }
118
- }
119
-
120
-
121
- const onSearchPrint = () => {
122
- navigation.navigate('SearchStarPrinter')
123
- }
124
-
125
- const onPrintStatus = async () => {
126
- const settings = new StarConnectionSettings();
127
- settings.interfaceType = InterfaceType.Lan;
128
- settings.identifier = '00:11:62:00:00:00';
129
- const printer = new StarPrinter(settings);
130
-
131
- try {
132
- // Connect to the printer.
133
- await printer.open();
134
-
135
- // Get printer status.
136
- const status = await printer.getStatus();
137
- console.log(status);
138
- }
139
- catch (error) {
140
- // Error.
141
- console.log(error);
142
- }
143
- finally {
144
- // Disconnect from the printer and dispose object.
145
- await printer.close();
146
- await printer.dispose();
147
- }
148
- }
149
-
150
- const onPrinterMonitor = async () => {
151
- let printer: StarPrinter;
152
- const settings = new StarConnectionSettings();
153
- settings.interfaceType = InterfaceType.Lan;
154
- settings.identifier = '00:11:62:00:00:00';
155
- printer = new StarPrinter(settings);
156
-
157
- // Callback for printer state changed.
158
- printer.printerDelegate.onReady = () => {
159
- console.log(`Printer: Ready`);
160
- }
161
- printer.drawerDelegate.onOpenCloseSignalSwitched = (openCloseSignal: any) => {
162
- console.log(`Drawer: Open Close Signal Switched: ${String(openCloseSignal)}`);
163
- }
164
- printer.inputDeviceDelegate.onDataReceived = (data: any) => {
165
- console.log(`Input Device: DataReceived ${String(data)}`);
166
- }
167
- printer.displayDelegate.onConnected = () => {
168
- console.log(`Display: Connected`);
169
- }
170
- // ...
171
- // Please refer to document for other callback.
172
-
173
- try {
174
- // Connect to the printer.
175
- await printer.open();
176
- }
177
- catch (error) {
178
- // Error.
179
- console.log(error);
180
- }
181
- }
182
-
183
- return (
184
- <View style={{ margin: 50 }}>
185
- <View style={{ flexDirection: 'row' }}>
186
- <Text style={{ width: 100 }}>Interface</Text>
187
- <Picker
188
- style={{ width: 200, marginLeft: 20, justifyContent: 'center' }}
189
- selectedValue={state.interfaceType}
190
- onValueChange={(value) => {
191
- setState({ ...state, interfaceType: value });
192
- }}>
193
- <Picker.Item label='Bluetooth' value={InterfaceType.Bluetooth} />
194
- <Picker.Item label='Bluetooth LE' value={InterfaceType.BluetoothLE} />
195
- </Picker>
196
- </View>
197
- <View style={{ flexDirection: 'row', marginTop: 30 }}>
198
- <Text style={{ width: 100 }}>Identifier</Text>
199
- <TextInput
200
- style={{ width: 200, marginLeft: 20 }}
201
- value={state.identifier}
202
- onChangeText={(value) => {
203
- setState({ ...state, identifier: value });
204
- }}
205
- />
206
- </View>
207
- <View style={{ width: 100, marginTop: 20 }}>
208
- <Button
209
- title="Search Printer"
210
- onPress={onSearchPrint}
211
- />
212
- </View>
213
- <View style={{ width: 100, marginTop: 20 }}>
214
- <Button
215
- title="Printer status"
216
- onPress={onPrintStatus}
217
- />
218
- </View>
219
- <View style={{ width: 100, marginTop: 20 }}>
220
- <Button
221
- title="Printer monitor"
222
- onPress={onPrinterMonitor}
223
- />
224
- </View>
225
- <View style={{ width: 100, marginTop: 20 }}>
226
- <Button
227
- title="Print"
228
- onPress={async () => await _onPressPrintButton()}
229
- />
230
- </View>
231
- </View>
232
- );
233
- };
234
-
235
- export default HandleStarPrinter;