ordering-ui-react-native 0.21.79 → 0.21.80-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/PaymentOptionsWebView/index.tsx +1 -0
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +3 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/Chat/index.tsx +3 -1
- package/themes/business/src/components/DriverMap/index.tsx +44 -27
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +36 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +74 -24
- package/themes/business/src/components/OrderDetails/Business.tsx +65 -7
- package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -20
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +110 -40
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -35
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderSummary/index.tsx +223 -73
- package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
- package/themes/business/src/components/OrdersOption/index.tsx +247 -159
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +25 -15
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +84 -47
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +23 -5
- package/themes/business/src/utils/index.tsx +19 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +13 -1
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
- package/themes/original/src/components/BusinessController/index.tsx +12 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +38 -11
- package/themes/original/src/components/CartContent/index.tsx +21 -8
- package/themes/original/src/components/Checkout/index.tsx +108 -60
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +2 -10
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +1 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/MomentOption/index.tsx +13 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +139 -87
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -1
- package/themes/original/src/components/MyOrders/index.tsx +21 -26
- package/themes/original/src/components/NavBar/index.tsx +4 -2
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +1 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
- package/themes/original/src/components/OrderDetails/index.tsx +27 -10
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderSummary/index.tsx +28 -9
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +2 -4
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +17 -9
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +8 -1
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +86 -78
- package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +10 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +77 -60
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +3 -2
- package/themes/original/src/components/UserFormDetails/index.tsx +155 -131
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Platform, PlatformIOSStatic,
|
|
2
|
+
import { Platform, PlatformIOSStatic, Pressable, StyleSheet, View } from 'react-native';
|
|
3
3
|
import DeviceInfo from 'react-native-device-info';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
|
|
@@ -47,6 +47,7 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
47
47
|
timer: configState?.configs?.order_deadlines_enabled?.value === '1',
|
|
48
48
|
slaBar: configState?.configs?.order_deadlines_enabled?.value === '1',
|
|
49
49
|
})
|
|
50
|
+
const showExternalId = configState?.configs?.change_order_id?.value === '1'
|
|
50
51
|
|
|
51
52
|
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
52
53
|
const platformIOS = Platform as PlatformIOSStatic
|
|
@@ -76,7 +77,6 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
76
77
|
marginLeft: 3,
|
|
77
78
|
},
|
|
78
79
|
title: {
|
|
79
|
-
marginBottom: 6,
|
|
80
80
|
fontFamily: 'Poppins',
|
|
81
81
|
fontStyle: 'normal',
|
|
82
82
|
fontWeight: '600',
|
|
@@ -84,7 +84,6 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
84
84
|
color: theme.colors.textGray,
|
|
85
85
|
},
|
|
86
86
|
date: {
|
|
87
|
-
marginBottom: 6,
|
|
88
87
|
fontFamily: 'Poppins',
|
|
89
88
|
fontStyle: 'normal',
|
|
90
89
|
fontWeight: 'normal',
|
|
@@ -120,7 +119,7 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
120
119
|
let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
|
|
121
120
|
let restMins: string | number = restMinOfTargetedMin - 60 * restHours
|
|
122
121
|
// make standard time format
|
|
123
|
-
day = day === 0 ? '' : day + 'day
|
|
122
|
+
day = day === 0 ? '' : `${day + ' ' + t('DAY', 'day') + ' '}`
|
|
124
123
|
restHours = restHours < 10 ? '0' + restHours : restHours
|
|
125
124
|
restMins = restMins < 10 ? '0' + restMins : restMins
|
|
126
125
|
|
|
@@ -138,8 +137,7 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
138
137
|
}, [configState.loading])
|
|
139
138
|
|
|
140
139
|
return (
|
|
141
|
-
<
|
|
142
|
-
activeOpacity={1}
|
|
140
|
+
<Pressable
|
|
143
141
|
disabled={order?.locked && isLogisticOrder}
|
|
144
142
|
style={styles.cardButton}
|
|
145
143
|
onPress={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
|
|
@@ -180,24 +178,36 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
180
178
|
/>
|
|
181
179
|
</NotificationIcon>
|
|
182
180
|
)}
|
|
183
|
-
<View
|
|
184
|
-
|
|
181
|
+
<View>
|
|
182
|
+
{!order?.order_group_id && showExternalId && !order?.order_group && (
|
|
183
|
+
<OText
|
|
184
|
+
style={styles.date}
|
|
185
|
+
color={theme.colors.unselectText}
|
|
186
|
+
numberOfLines={1}
|
|
187
|
+
adjustsFontSizeToFit
|
|
188
|
+
>
|
|
189
|
+
{`${order?.external_id ?? t('NO_EXTERNAL_ID', 'No external Id ') + t('NO', 'Order No.') + order?.id}` + ' · ' + `${order?.delivery_datetime_utc
|
|
190
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
191
|
+
: parseDate(order?.delivery_datetime, { utc: false })
|
|
192
|
+
}`}
|
|
193
|
+
</OText>
|
|
194
|
+
)}
|
|
195
|
+
{!showExternalId && (<OText
|
|
185
196
|
style={styles.date}
|
|
186
197
|
color={theme.colors.unselectText}
|
|
187
198
|
numberOfLines={1}
|
|
188
199
|
adjustsFontSizeToFit
|
|
189
200
|
>
|
|
190
|
-
{(!!order?.order_group_id && order?.order_group && isLogisticOrder
|
|
201
|
+
{((!!order?.order_group_id && order?.order_group && isLogisticOrder
|
|
191
202
|
? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}`
|
|
192
|
-
: (t('NO', 'Order No.') + order
|
|
193
|
-
) + ' · '
|
|
194
|
-
{order?.delivery_datetime_utc
|
|
203
|
+
: (t('NO', 'Order No.') + order?.id)
|
|
204
|
+
) + ' · ' + `${order?.delivery_datetime_utc
|
|
195
205
|
? parseDate(order?.delivery_datetime_utc)
|
|
196
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
206
|
+
: parseDate(order?.delivery_datetime, { utc: false })}`)}
|
|
197
207
|
</OText>
|
|
208
|
+
)}
|
|
198
209
|
{((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
|
|
199
210
|
<>
|
|
200
|
-
<OText> · </OText>
|
|
201
211
|
<OText
|
|
202
212
|
style={styles.date}
|
|
203
213
|
color={
|
|
@@ -237,6 +247,6 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
237
247
|
)}
|
|
238
248
|
</Information>
|
|
239
249
|
</Card>
|
|
240
|
-
</
|
|
250
|
+
</Pressable>
|
|
241
251
|
)
|
|
242
252
|
}, OrderItemPropsAreEqual)
|
|
@@ -45,6 +45,8 @@ export const PreviousOrders = (props: any) => {
|
|
|
45
45
|
const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
|
|
46
46
|
const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23]
|
|
47
47
|
const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1' && !isBusinessApp
|
|
48
|
+
const isEnabledOrderNotReady = configs?.order_not_ready_enabled?.value === '1'
|
|
49
|
+
const isEnabledFailedPickupDriver = configs?.failed_pickup_by_driver_enabled?.value === '1'
|
|
48
50
|
|
|
49
51
|
const handlePressOrder = (order: any) => {
|
|
50
52
|
if (order?.locked && isLogisticOrder) return
|
|
@@ -242,7 +244,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
242
244
|
/>
|
|
243
245
|
</AcceptOrRejectOrderStyle>
|
|
244
246
|
)}
|
|
245
|
-
{_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 && !isHideRejectButtons &&
|
|
247
|
+
{_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 && !isHideRejectButtons && isEnabledOrderNotReady &&
|
|
246
248
|
(
|
|
247
249
|
<AcceptOrRejectOrderStyle>
|
|
248
250
|
<OButton
|
|
@@ -330,9 +332,9 @@ export const PreviousOrders = (props: any) => {
|
|
|
330
332
|
})}
|
|
331
333
|
/>
|
|
332
334
|
)}
|
|
333
|
-
{!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && (
|
|
335
|
+
{!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && isEnabledFailedPickupDriver && (
|
|
334
336
|
<AcceptOrRejectOrderStyle>
|
|
335
|
-
{!isHideRejectButtons && (
|
|
337
|
+
{!isHideRejectButtons && isEnabledOrderNotReady && (
|
|
336
338
|
<OButton
|
|
337
339
|
text={t('PICKUP_FAILED', 'Pickup failed')}
|
|
338
340
|
bgColor={theme.colors.danger100}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Dimensions, SafeAreaView, StyleSheet, View } from 'react-native';
|
|
3
|
+
import SelectDropdown from 'react-native-select-dropdown'
|
|
4
|
+
import { useLanguage } from 'ordering-components/native'
|
|
5
|
+
import { useTheme } from 'styled-components/native'
|
|
6
|
+
import { useForm, Controller } from 'react-hook-form';
|
|
7
|
+
import FAIcons from 'react-native-vector-icons/FontAwesome'
|
|
8
|
+
import MCIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
9
|
+
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'
|
|
10
|
+
import FeatherIcon from 'react-native-vector-icons/Feather'
|
|
11
|
+
import {
|
|
12
|
+
ContainerEdition,
|
|
13
|
+
BackArrowWrapper,
|
|
14
|
+
BackArrow,
|
|
15
|
+
WrapperIcons,
|
|
16
|
+
WrapperHeader,
|
|
17
|
+
WrapperIcon
|
|
18
|
+
} from './styles'
|
|
19
|
+
|
|
20
|
+
import { Container } from '../../layouts/Container'
|
|
21
|
+
import { OText, OInput, OIcon, OButton } from '../shared'
|
|
22
|
+
|
|
23
|
+
const printerList = [
|
|
24
|
+
{ nickname: 'mPOP', model: 'mPOP', emulation: 'StarPRNT', portName1: 'BT:mPOP', type: 1, ip: '', printMode: 'append' },
|
|
25
|
+
{ nickname: 'FVP10', model: 'FVP10', emulation: 'StarLine', portName1: 'BT:FVP10', type: 1, ip: '', printMode: 'append' },
|
|
26
|
+
{ nickname: 'TSP100', model: 'TSP100', emulation: 'StarGraphic', portName1: 'BT:TSP100', type: 1, ip: '', printMode: 'appendBitmapText' },
|
|
27
|
+
{ nickname: 'TSP100IV', model: 'TSP100IV', emulation: 'StarLine', portName1: 'BT:TSP100iv', type: 1, ip: '', printMode: 'append' },
|
|
28
|
+
{ nickname: 'TSP65011', model: 'TSP65011', emulation: 'StarLine', portName1: 'BT:TSP65011', type: 1, ip: '', printMode: 'append' },
|
|
29
|
+
{ nickname: 'TSP7001', model: 'TSP7001', emulation: 'StarLine', portName1: 'BT:TSP7001', type: 1, ip: '', printMode: 'append' },
|
|
30
|
+
{ nickname: 'TSP80011', model: 'TSP80011', emulation: 'StarLine', portName1: 'BT:TSP80011', type: 1, ip: '', printMode: 'append' },
|
|
31
|
+
{ nickname: 'SP700', model: 'SP700', emulation: 'StarDotImpact', portName1: 'BT:SP700', type: 1, ip: '', printMode: 'append' },
|
|
32
|
+
{ nickname: 'SM-S210i', model: 'SM-S210i', emulation: 'EscPosMobile', portName1: 'BT:SMS210i', type: 1, ip: '', printMode: 'append' },
|
|
33
|
+
{ nickname: 'SM-S220i', model: 'SM-S220i', emulation: 'EscPosMobile', portName1: 'BT:SMS220i', type: 1, ip: '', printMode: 'append' },
|
|
34
|
+
{ nickname: 'SM-S230i', model: 'SM-S230i', emulation: 'EscosMobile', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
|
|
35
|
+
{ nickname: 'SM-T300i/T300', model: 'SM-T300i/T300', emulation: 'EscPosMobile', portName1: 'BT:SMT300i/T300', type: 1, ip: '', printMode: 'append' },
|
|
36
|
+
{ nickname: 'SM-T400i', model: 'SM-T400i', emulation: 'EscosMobile', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
|
|
37
|
+
{ nickname: 'SM-L200', model: 'SM-L200', emulation: 'StarPRNT', portName1: 'BT:SML200', type: 1, ip: '', printMode: 'append' },
|
|
38
|
+
{ nickname: 'SM-L300', model: 'SM-L300', emulation: 'StarPRNT', portName1: 'BT:SML300', type: 1, ip: '', printMode: 'append' },
|
|
39
|
+
{ nickname: 'BSC10', model: 'BSC10', emulation: 'EscPos', portName1: 'BT:BSC10', type: 1, ip: '', printMode: 'append' },
|
|
40
|
+
{ nickname: 'SM-S210i StarPRNT', model: 'SM-S210i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS210i', type: 1, ip: '', printMode: 'append' },
|
|
41
|
+
{ nickname: 'SM-S220i StarPRNT', model: 'SM-S220i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS220i', type: 1, ip: '', printMode: 'append' },
|
|
42
|
+
{ nickname: 'SM-S230i StarPRNT', model: 'SM-S230i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
|
|
43
|
+
{ nickname: 'SM-T300i/T300 StarPRNT', model: 'SM-T300i/T300 StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT300i', type: 1, ip: '', printMode: 'append' },
|
|
44
|
+
{ nickname: 'SM-T400i StarPRNT', model: 'SM-T400i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
export const PrinterEdition = (props: any) => {
|
|
48
|
+
const {
|
|
49
|
+
printer,
|
|
50
|
+
onClose
|
|
51
|
+
} = props
|
|
52
|
+
|
|
53
|
+
const HEIGHT_SCREEN = Dimensions.get('window').height
|
|
54
|
+
const [, t] = useLanguage()
|
|
55
|
+
const theme = useTheme()
|
|
56
|
+
const { handleSubmit, control, setValue, watch } = useForm();
|
|
57
|
+
|
|
58
|
+
const watchIp = watch('ip')
|
|
59
|
+
const watchNickname = watch('nickname')
|
|
60
|
+
const isErrorIp = !/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i.test(watchIp)
|
|
61
|
+
const isErrorNickname = watchNickname && !/^[a-zA-Z0-9\s]+$/i.test(watchNickname)
|
|
62
|
+
|
|
63
|
+
const [currentPrinter, setCurrentPrinter] = useState(printer)
|
|
64
|
+
|
|
65
|
+
const styles = StyleSheet.create({
|
|
66
|
+
icons: {
|
|
67
|
+
maxWidth: 40,
|
|
68
|
+
height: 40,
|
|
69
|
+
padding: 10,
|
|
70
|
+
alignItems: 'flex-end'
|
|
71
|
+
},
|
|
72
|
+
optionIcons: {
|
|
73
|
+
paddingRight: 10
|
|
74
|
+
},
|
|
75
|
+
inputStyle: {
|
|
76
|
+
height: 40,
|
|
77
|
+
borderWidth: 1,
|
|
78
|
+
borderRadius: 8,
|
|
79
|
+
},
|
|
80
|
+
savePrinterBtnText: {
|
|
81
|
+
color: theme.colors.white,
|
|
82
|
+
fontSize: 18,
|
|
83
|
+
},
|
|
84
|
+
savePrinterBtn: {
|
|
85
|
+
height: 44,
|
|
86
|
+
borderRadius: 8,
|
|
87
|
+
marginHorizontal: 20
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const handleChangePrinter = (values: any) => {
|
|
92
|
+
props.handleChangePrinter({
|
|
93
|
+
...values,
|
|
94
|
+
index: currentPrinter?.index ?? null,
|
|
95
|
+
type: currentPrinter?.type,
|
|
96
|
+
ip: currentPrinter?.ip,
|
|
97
|
+
item: currentPrinter
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const onSubmit = () => {
|
|
102
|
+
handleChangePrinter({ edit: !!printer, isAdd: !printer })
|
|
103
|
+
onClose && onClose()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
currentPrinter?.ip && setValue('ip', currentPrinter?.ip)
|
|
108
|
+
currentPrinter?.nickname && setValue('nickname', currentPrinter?.nickname)
|
|
109
|
+
}, [currentPrinter?.type])
|
|
110
|
+
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
setCurrentPrinter(printer)
|
|
113
|
+
}, [printer])
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<SafeAreaView style={{ flex: 1, marginBottom: 20 }}>
|
|
117
|
+
<Container>
|
|
118
|
+
<ContainerEdition>
|
|
119
|
+
<BackArrowWrapper>
|
|
120
|
+
<BackArrow activeOpacity={1} onPress={() => onClose()}>
|
|
121
|
+
<OIcon
|
|
122
|
+
src={theme.images.general.arrow_left}
|
|
123
|
+
color={theme.colors.textGray}
|
|
124
|
+
/>
|
|
125
|
+
</BackArrow>
|
|
126
|
+
</BackArrowWrapper>
|
|
127
|
+
<WrapperHeader>
|
|
128
|
+
<SimpleLineIcons
|
|
129
|
+
name='printer'
|
|
130
|
+
color={theme.colors.textGray}
|
|
131
|
+
size={20}
|
|
132
|
+
style={{
|
|
133
|
+
...styles.icons,
|
|
134
|
+
paddingLeft: 0,
|
|
135
|
+
color: theme.colors.primary
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
<OText
|
|
139
|
+
size={22}
|
|
140
|
+
style={{ paddingTop: 0 }}
|
|
141
|
+
>
|
|
142
|
+
{t('PRINTER_CONFIGURE', 'Printer Configure')}
|
|
143
|
+
</OText>
|
|
144
|
+
</WrapperHeader>
|
|
145
|
+
|
|
146
|
+
<SelectDropdown
|
|
147
|
+
data={printerList}
|
|
148
|
+
defaultValueByIndex={printerList.findIndex(p => p.model === currentPrinter?.model)}
|
|
149
|
+
dropdownOverlayColor='transparent'
|
|
150
|
+
defaultButtonText={t('SELECT_PRINTER', 'Select printer')}
|
|
151
|
+
buttonTextAfterSelection={item => item.model}
|
|
152
|
+
rowTextForSelection={item => item.model}
|
|
153
|
+
renderDropdownIcon={() => dropDownIcon()}
|
|
154
|
+
buttonStyle={{
|
|
155
|
+
width: '100%',
|
|
156
|
+
backgroundColor: theme.colors.primary,
|
|
157
|
+
borderRadius: 8,
|
|
158
|
+
flexDirection: 'row-reverse',
|
|
159
|
+
justifyContent: 'space-between',
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
height: 44,
|
|
162
|
+
marginTop: 20,
|
|
163
|
+
}}
|
|
164
|
+
buttonTextStyle={{
|
|
165
|
+
color: theme.colors.white,
|
|
166
|
+
fontSize: 18,
|
|
167
|
+
textAlign: 'left',
|
|
168
|
+
marginHorizontal: 0
|
|
169
|
+
}}
|
|
170
|
+
dropdownStyle={{
|
|
171
|
+
borderRadius: 8,
|
|
172
|
+
borderColor: theme.colors.primary,
|
|
173
|
+
maxHeight: HEIGHT_SCREEN * 0.3
|
|
174
|
+
}}
|
|
175
|
+
rowStyle={{
|
|
176
|
+
borderBottomColor: theme.colors.disabled,
|
|
177
|
+
backgroundColor: theme.colors.gray100,
|
|
178
|
+
height: 40,
|
|
179
|
+
flexDirection: 'column',
|
|
180
|
+
alignItems: 'flex-start',
|
|
181
|
+
paddingTop: 8,
|
|
182
|
+
paddingHorizontal: 14,
|
|
183
|
+
width: '100%'
|
|
184
|
+
}}
|
|
185
|
+
rowTextStyle={{
|
|
186
|
+
marginHorizontal: 0,
|
|
187
|
+
fontSize: 14,
|
|
188
|
+
}}
|
|
189
|
+
onSelect={item => setCurrentPrinter(item)}
|
|
190
|
+
/>
|
|
191
|
+
{!!currentPrinter && (
|
|
192
|
+
<WrapperIcons>
|
|
193
|
+
<OText
|
|
194
|
+
size={20}
|
|
195
|
+
style={{ paddingTop: 0, marginBottom: 10 }}
|
|
196
|
+
>
|
|
197
|
+
{`${t('PRINTER_NICKNAME', 'Nickname')}:`}
|
|
198
|
+
</OText>
|
|
199
|
+
<Controller
|
|
200
|
+
control={control}
|
|
201
|
+
name={'nickname'}
|
|
202
|
+
rules={{
|
|
203
|
+
pattern: {
|
|
204
|
+
value: /^[a-zA-Z0-9\s]+$/i,
|
|
205
|
+
message: t('INVALID_ERROR_PRINTER_NICKNAME', 'Invalid Nickname')
|
|
206
|
+
}
|
|
207
|
+
}}
|
|
208
|
+
defaultValue={currentPrinter?.ip ?? ''}
|
|
209
|
+
render={() => (
|
|
210
|
+
<OInput
|
|
211
|
+
placeholder={`${t('EXAMPLE_SHORT', 'Ex:')} ${t('NICKNAME_EXAMPLE_TEXT', 'Kitchen printer')}`}
|
|
212
|
+
placeholderTextColor={theme.colors.arrowColor}
|
|
213
|
+
style={{
|
|
214
|
+
...styles.inputStyle,
|
|
215
|
+
borderColor: isErrorNickname ? theme.colors.danger500 : theme.colors.tabBar,
|
|
216
|
+
marginBottom: 10
|
|
217
|
+
}}
|
|
218
|
+
value={currentPrinter?.nickname ?? ''}
|
|
219
|
+
selectionColor={theme.colors.primary}
|
|
220
|
+
color={theme.colors.textGray}
|
|
221
|
+
onChange={(value: any) => {
|
|
222
|
+
setValue('nickname', value)
|
|
223
|
+
setCurrentPrinter({
|
|
224
|
+
...currentPrinter,
|
|
225
|
+
nickname: value
|
|
226
|
+
})
|
|
227
|
+
}}
|
|
228
|
+
/>
|
|
229
|
+
)}
|
|
230
|
+
/>
|
|
231
|
+
<OText
|
|
232
|
+
size={20}
|
|
233
|
+
style={{ paddingTop: 0, marginBottom: 10 }}
|
|
234
|
+
>
|
|
235
|
+
{`${t('CONNECTION_TYPE', 'Connection type')}:`}
|
|
236
|
+
</OText>
|
|
237
|
+
<WrapperIcon
|
|
238
|
+
activeOpacity={1}
|
|
239
|
+
style={{
|
|
240
|
+
borderColor: currentPrinter?.type === 1 ? theme.colors.primary : theme.colors.textGray
|
|
241
|
+
}}
|
|
242
|
+
onPress={() => {
|
|
243
|
+
setCurrentPrinter({
|
|
244
|
+
...currentPrinter,
|
|
245
|
+
type: 1,
|
|
246
|
+
ip: '',
|
|
247
|
+
portName: currentPrinter?.portName1
|
|
248
|
+
})
|
|
249
|
+
}}
|
|
250
|
+
>
|
|
251
|
+
<FAIcons
|
|
252
|
+
name='bluetooth'
|
|
253
|
+
size={22}
|
|
254
|
+
{...(currentPrinter?.type === 1 ? { color: theme.colors.primary } : {})}
|
|
255
|
+
style={styles.optionIcons}
|
|
256
|
+
/>
|
|
257
|
+
<OText
|
|
258
|
+
size={18}
|
|
259
|
+
style={{ paddingTop: 0 }}
|
|
260
|
+
>
|
|
261
|
+
{t('CONNECTION_VIA_BLUETOOTH', 'Via Bluetooth')}
|
|
262
|
+
</OText>
|
|
263
|
+
</WrapperIcon>
|
|
264
|
+
<WrapperIcon
|
|
265
|
+
activeOpacity={1}
|
|
266
|
+
style={{
|
|
267
|
+
borderColor: currentPrinter?.type === 2 ? theme.colors.primary : theme.colors.textGray
|
|
268
|
+
}}
|
|
269
|
+
onPress={() => setCurrentPrinter({ ...currentPrinter, type: 2 })}
|
|
270
|
+
>
|
|
271
|
+
<MCIcons
|
|
272
|
+
name='access-point-network'
|
|
273
|
+
size={22}
|
|
274
|
+
{...(currentPrinter?.type === 2 ? { color: theme.colors.primary } : {})}
|
|
275
|
+
style={styles.optionIcons}
|
|
276
|
+
/>
|
|
277
|
+
<OText
|
|
278
|
+
size={18}
|
|
279
|
+
style={{ paddingTop: 0 }}
|
|
280
|
+
>
|
|
281
|
+
{t('CONNECTION_VIA_LAN', 'Via LAN')}
|
|
282
|
+
</OText>
|
|
283
|
+
</WrapperIcon>
|
|
284
|
+
{currentPrinter?.type === 2 && (
|
|
285
|
+
<>
|
|
286
|
+
<View style={{ flexDirection: 'row' }}>
|
|
287
|
+
<Controller
|
|
288
|
+
control={control}
|
|
289
|
+
name={'ip'}
|
|
290
|
+
rules={{
|
|
291
|
+
required: t('VALIDATION_ERROR_IP_ADDRESS_REQUIRED', 'Ip address is required'),
|
|
292
|
+
pattern: {
|
|
293
|
+
value: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i,
|
|
294
|
+
message: t('INVALID_ERROR_IP_ADDRESS', 'Invalid ip address')
|
|
295
|
+
}
|
|
296
|
+
}}
|
|
297
|
+
defaultValue={currentPrinter?.ip ?? ''}
|
|
298
|
+
render={() => (
|
|
299
|
+
<OInput
|
|
300
|
+
placeholder={t('IP_ADDRESS', 'Ip address')}
|
|
301
|
+
placeholderTextColor={theme.colors.arrowColor}
|
|
302
|
+
style={{
|
|
303
|
+
...styles.inputStyle,
|
|
304
|
+
borderColor: isErrorIp ? theme.colors.danger500 : theme.colors.tabBar
|
|
305
|
+
}}
|
|
306
|
+
value={currentPrinter?.ip ?? ''}
|
|
307
|
+
selectionColor={theme.colors.primary}
|
|
308
|
+
color={theme.colors.textGray}
|
|
309
|
+
onChange={(value: any) => {
|
|
310
|
+
setValue('ip', value)
|
|
311
|
+
setCurrentPrinter({
|
|
312
|
+
...currentPrinter,
|
|
313
|
+
ip: value
|
|
314
|
+
})
|
|
315
|
+
}}
|
|
316
|
+
/>
|
|
317
|
+
)}
|
|
318
|
+
/>
|
|
319
|
+
</View>
|
|
320
|
+
<OText
|
|
321
|
+
size={14}
|
|
322
|
+
color={theme.colors.tabBar}
|
|
323
|
+
style={{ paddingTop: 5, paddingLeft: 10 }}
|
|
324
|
+
>
|
|
325
|
+
{`${t('EXAMPLE_SHORT', 'Ex:')} 8.8.8.8`}
|
|
326
|
+
</OText>
|
|
327
|
+
</>
|
|
328
|
+
)}
|
|
329
|
+
</WrapperIcons>
|
|
330
|
+
)}
|
|
331
|
+
</ContainerEdition>
|
|
332
|
+
</Container>
|
|
333
|
+
<View>
|
|
334
|
+
<OButton
|
|
335
|
+
text={t('SAVE_PRINTER', 'Save Printer')}
|
|
336
|
+
imgRightSrc={null}
|
|
337
|
+
textStyle={styles.savePrinterBtnText}
|
|
338
|
+
style={styles.savePrinterBtn}
|
|
339
|
+
bgColor={theme.colors.primary}
|
|
340
|
+
borderColor={theme.colors.primary}
|
|
341
|
+
isDisabled={
|
|
342
|
+
isErrorNickname ||
|
|
343
|
+
!currentPrinter?.model ||
|
|
344
|
+
currentPrinter?.type === 2 && !currentPrinter?.ip
|
|
345
|
+
}
|
|
346
|
+
onClick={() => onSubmit()}
|
|
347
|
+
/>
|
|
348
|
+
</View>
|
|
349
|
+
</SafeAreaView>
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const dropDownIcon = () => {
|
|
354
|
+
const theme = useTheme()
|
|
355
|
+
|
|
356
|
+
return (
|
|
357
|
+
<FeatherIcon
|
|
358
|
+
name='chevron-down'
|
|
359
|
+
size={20}
|
|
360
|
+
color={theme.colors.white}
|
|
361
|
+
/>
|
|
362
|
+
)
|
|
363
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
|
+
|
|
3
|
+
export const ContainerEdition = styled.View`
|
|
4
|
+
margin-bottom: 50px;
|
|
5
|
+
`
|
|
6
|
+
|
|
7
|
+
export const BackArrowWrapper = styled.View`
|
|
8
|
+
align-items: center;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
min-height: 33px;
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export const BackArrow = styled.TouchableOpacity`
|
|
14
|
+
border-width: 0;
|
|
15
|
+
width: 32px;
|
|
16
|
+
height: 32px;
|
|
17
|
+
tint-color: ${(props: any) => props.theme.colors.textGray};
|
|
18
|
+
background-color: ${(props: any) => props.theme.colors.clear};
|
|
19
|
+
border-color: ${(props: any) => props.theme.colors.clear};
|
|
20
|
+
shadow-color: ${(props: any) => props.theme.colors.clear};
|
|
21
|
+
padding-left: 0;
|
|
22
|
+
padding-right: 0;
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
export const WrapperHeader = styled.View`
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
justify-content: flex-start;
|
|
28
|
+
align-items: center;
|
|
29
|
+
width: 100%;
|
|
30
|
+
`
|
|
31
|
+
|
|
32
|
+
export const WrapperIcons = styled.View`
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
justify-content: flex-start;
|
|
35
|
+
margin-top: 20px;
|
|
36
|
+
`
|
|
37
|
+
|
|
38
|
+
export const WrapperIcon = styled.TouchableOpacity`
|
|
39
|
+
flex-direction: row;
|
|
40
|
+
justify-content: flex-start;
|
|
41
|
+
padding: 8px;
|
|
42
|
+
border-width: 1px;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
margin-bottom: 10px;
|
|
45
|
+
`
|
|
46
|
+
|
|
47
|
+
export const ContainerList = styled.View`
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
width: 100%;
|
|
51
|
+
padding: 5px 5px 5px 0;
|
|
52
|
+
border-bottom-width: 1px;
|
|
53
|
+
border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
|
|
54
|
+
`
|
|
55
|
+
|
|
56
|
+
export const EnabledAutoPrint = styled.View`
|
|
57
|
+
flex-direction: row;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
align-items: center;
|
|
60
|
+
padding: 20px 0px 10px;
|
|
61
|
+
`;
|