ordering-ui-react-native 0.21.78 → 0.21.79-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 +222 -72
- 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/ProductItemAccordion/index.tsx +2 -2
- 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
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View, Dimensions } from 'react-native'
|
|
3
|
+
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'
|
|
4
|
+
import FeatherIcon from 'react-native-vector-icons/Feather'
|
|
5
|
+
import { useTheme } from 'styled-components/native'
|
|
6
|
+
import ToggleSwitch from 'toggle-switch-react-native';
|
|
7
|
+
import { useLanguage } from 'ordering-components/native'
|
|
8
|
+
|
|
9
|
+
import { _setStoreData, _retrieveStoreData } from '../../providers/StoreUtil'
|
|
10
|
+
import { Container, ContainerList, EnabledAutoPrint, NoPrintersContainer } from './styles'
|
|
11
|
+
import { OText, OIcon, OModal, OButton } from '../shared'
|
|
12
|
+
import { PrinterEdition } from '../PrinterEdition'
|
|
13
|
+
|
|
14
|
+
export const PrinterSettings = (props: any) => {
|
|
15
|
+
const { navigation, onClose } = props
|
|
16
|
+
|
|
17
|
+
const [printers, setPrinters] = useState<any>({ list: [] })
|
|
18
|
+
const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
|
|
19
|
+
const [openModal, setOpenModal] = useState<any>({ open: false, data: null })
|
|
20
|
+
|
|
21
|
+
const WIDTH_SCREEN = Dimensions.get('window').width
|
|
22
|
+
const HEIGHT_SCREEN = Dimensions.get('window').height
|
|
23
|
+
|
|
24
|
+
const [, t] = useLanguage()
|
|
25
|
+
const theme = useTheme()
|
|
26
|
+
|
|
27
|
+
const styles = StyleSheet.create({
|
|
28
|
+
icons: {
|
|
29
|
+
maxWidth: 40,
|
|
30
|
+
height: 40,
|
|
31
|
+
padding: 10,
|
|
32
|
+
alignItems: 'flex-end'
|
|
33
|
+
},
|
|
34
|
+
optionIcons: {
|
|
35
|
+
padding: 8,
|
|
36
|
+
borderWidth: 1,
|
|
37
|
+
marginRight: 10,
|
|
38
|
+
borderRadius: 8,
|
|
39
|
+
},
|
|
40
|
+
wIconContainer: {
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
width: WIDTH_SCREEN - 40 - 22 - 22 - 10, // screen - margin - icon - icon - marginIcon
|
|
44
|
+
},
|
|
45
|
+
wrapperContainer: {
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
},
|
|
48
|
+
wrapperIcons: {
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
justifyContent: 'flex-start',
|
|
51
|
+
marginBottom: 5,
|
|
52
|
+
},
|
|
53
|
+
inputStyle: {
|
|
54
|
+
height: 40,
|
|
55
|
+
borderWidth: 1,
|
|
56
|
+
borderRadius: 8,
|
|
57
|
+
},
|
|
58
|
+
btnBackArrow: {
|
|
59
|
+
borderWidth: 0,
|
|
60
|
+
width: 32,
|
|
61
|
+
height: 32,
|
|
62
|
+
tintColor: theme.colors.textGray,
|
|
63
|
+
backgroundColor: theme.colors.clear,
|
|
64
|
+
borderColor: theme.colors.clear,
|
|
65
|
+
shadowColor: theme.colors.clear,
|
|
66
|
+
paddingLeft: 0,
|
|
67
|
+
paddingRight: 0,
|
|
68
|
+
},
|
|
69
|
+
titleGroups: {
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
minHeight: 33,
|
|
73
|
+
},
|
|
74
|
+
addButtonText: {
|
|
75
|
+
color: theme.colors.inputTextColor,
|
|
76
|
+
fontSize: 16,
|
|
77
|
+
},
|
|
78
|
+
addButton: {
|
|
79
|
+
height: 40,
|
|
80
|
+
marginTop: 10,
|
|
81
|
+
borderRadius: 8,
|
|
82
|
+
marginRight: 10,
|
|
83
|
+
marginBottom: 10,
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
88
|
+
|
|
89
|
+
const handleClick = async ({ item, type, ip, edit, isAdd, index }: any) => {
|
|
90
|
+
let _item = item
|
|
91
|
+
const action = edit || isAdd
|
|
92
|
+
let _printers = printers.list
|
|
93
|
+
const idx = index ?? _printers.findIndex((p: any) => p.model === _item.model)
|
|
94
|
+
|
|
95
|
+
if (idx !== -1 && !action) {
|
|
96
|
+
_printers.splice(idx, 1);
|
|
97
|
+
} else {
|
|
98
|
+
const _currentPrinter = _printers.find((p: any) => p.model === _item?.model)
|
|
99
|
+
_item = {
|
|
100
|
+
..._currentPrinter,
|
|
101
|
+
...item,
|
|
102
|
+
type: type ?? _currentPrinter?.type ?? 1,
|
|
103
|
+
ip: ip ?? _currentPrinter?.ip ?? '',
|
|
104
|
+
portName: (type ?? _currentPrinter?.type) === 1 || !ip
|
|
105
|
+
? item.portName1 ?? _currentPrinter?.portName1
|
|
106
|
+
: `TCP:${ip}`
|
|
107
|
+
}
|
|
108
|
+
edit ? (_printers[idx] = _item) : _printers.push(_item)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
setPrinters({ list: _printers })
|
|
112
|
+
await _setStoreData('printers', _printers)
|
|
113
|
+
type === 1 && onClose && onClose()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const handleAutoPrint = async () => {
|
|
117
|
+
setAutoPrintEnabled(!autoPrintEnabled)
|
|
118
|
+
await _setStoreData('auto_print_after_accept_order', !autoPrintEnabled)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
const getStorageData = async () => {
|
|
123
|
+
const printers = await _retrieveStoreData('printers')
|
|
124
|
+
const autoPrint = await _retrieveStoreData('auto_print_after_accept_order')
|
|
125
|
+
setPrinters({ list: printers ?? [] })
|
|
126
|
+
setAutoPrintEnabled(!!autoPrint)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
getStorageData()
|
|
130
|
+
}, [])
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<Container>
|
|
134
|
+
<View style={styles.titleGroups}>
|
|
135
|
+
<TouchableOpacity onPress={() => goToBack()} style={styles.btnBackArrow}>
|
|
136
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
|
|
137
|
+
</TouchableOpacity>
|
|
138
|
+
</View>
|
|
139
|
+
<OText size={24} style={{ paddingTop: 0 }}>
|
|
140
|
+
{t('PRINTER_SETTINGS', 'Printer Settings')}
|
|
141
|
+
</OText>
|
|
142
|
+
{!!printers.list.length && (
|
|
143
|
+
<EnabledAutoPrint>
|
|
144
|
+
<View style={{ flex: 1 }}>
|
|
145
|
+
<OText
|
|
146
|
+
numberOfLines={2}
|
|
147
|
+
adjustsFontSizeToFit
|
|
148
|
+
color={theme.colors.textGray}
|
|
149
|
+
style={{ paddingHorizontal: 0 }}>
|
|
150
|
+
{t('AUTO_PRINT_AFTER_ACCEPTING_ORDER', 'Auto print after accepting order')}
|
|
151
|
+
</OText>
|
|
152
|
+
</View>
|
|
153
|
+
<ToggleSwitch
|
|
154
|
+
isOn={autoPrintEnabled}
|
|
155
|
+
onColor={theme.colors.primary}
|
|
156
|
+
offColor={theme.colors.offColor}
|
|
157
|
+
size="small"
|
|
158
|
+
onToggle={() => handleAutoPrint()}
|
|
159
|
+
animationSpeed={200}
|
|
160
|
+
/>
|
|
161
|
+
</EnabledAutoPrint>
|
|
162
|
+
)}
|
|
163
|
+
{!!printers.list.length && (
|
|
164
|
+
<OButton
|
|
165
|
+
text={t('ADD_PRINTER', 'Add printer')}
|
|
166
|
+
imgRightSrc={null}
|
|
167
|
+
textStyle={styles.addButtonText}
|
|
168
|
+
style={styles.addButton}
|
|
169
|
+
bgColor={theme.colors.primary}
|
|
170
|
+
borderColor={theme.colors.primary}
|
|
171
|
+
onClick={() => setOpenModal({ open: true, data: null })}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
174
|
+
<View>
|
|
175
|
+
{printers.list.map((item: any, i: number) => (
|
|
176
|
+
<ContainerList
|
|
177
|
+
key={i}
|
|
178
|
+
activeOpacity={1}
|
|
179
|
+
>
|
|
180
|
+
<View style={styles.wrapperContainer}>
|
|
181
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
182
|
+
<TouchableOpacity
|
|
183
|
+
activeOpacity={1}
|
|
184
|
+
style={styles.wIconContainer}
|
|
185
|
+
onPress={() => setOpenModal({ open: true, data: { ...item, index: i} })}
|
|
186
|
+
>
|
|
187
|
+
<SimpleLineIcons
|
|
188
|
+
name='printer'
|
|
189
|
+
color={theme.colors.textGray}
|
|
190
|
+
size={18}
|
|
191
|
+
style={{
|
|
192
|
+
...styles.icons,
|
|
193
|
+
color: theme.colors.primary
|
|
194
|
+
}}
|
|
195
|
+
/>
|
|
196
|
+
<OText
|
|
197
|
+
size={18}
|
|
198
|
+
color={theme.colors.primary}
|
|
199
|
+
>
|
|
200
|
+
{item?.nickname ?? item.model}
|
|
201
|
+
</OText>
|
|
202
|
+
</TouchableOpacity>
|
|
203
|
+
<TouchableOpacity
|
|
204
|
+
activeOpacity={1}
|
|
205
|
+
onPress={() => setOpenModal({ open: true, data: { ...item, index: i} })}
|
|
206
|
+
>
|
|
207
|
+
<FeatherIcon
|
|
208
|
+
name='edit'
|
|
209
|
+
size={22}
|
|
210
|
+
/>
|
|
211
|
+
</TouchableOpacity>
|
|
212
|
+
<TouchableOpacity
|
|
213
|
+
activeOpacity={1}
|
|
214
|
+
onPress={() => handleClick({ item })}
|
|
215
|
+
style={{ marginLeft: 10 }}
|
|
216
|
+
>
|
|
217
|
+
<FeatherIcon
|
|
218
|
+
name='trash-2'
|
|
219
|
+
size={22}
|
|
220
|
+
color={theme.colors.danger500}
|
|
221
|
+
/>
|
|
222
|
+
</TouchableOpacity>
|
|
223
|
+
</View>
|
|
224
|
+
</View>
|
|
225
|
+
</ContainerList>
|
|
226
|
+
))}
|
|
227
|
+
{!printers.list.length && (
|
|
228
|
+
<NoPrintersContainer style={{ height: HEIGHT_SCREEN/2 }}>
|
|
229
|
+
<OText
|
|
230
|
+
size={20}
|
|
231
|
+
color={theme.colors.textGray}
|
|
232
|
+
numberOfLines={2}
|
|
233
|
+
adjustsFontSizeToFit
|
|
234
|
+
style={{ paddingHorizontal: 0, opacity: 0.4 }}
|
|
235
|
+
>
|
|
236
|
+
{t('NO_PRINTERS_CONFIGURED', 'No printers configured')}
|
|
237
|
+
</OText>
|
|
238
|
+
<OButton
|
|
239
|
+
text={t('ADD_PRINTER', 'Add printer')}
|
|
240
|
+
imgRightSrc={null}
|
|
241
|
+
textStyle={styles.addButtonText}
|
|
242
|
+
style={styles.addButton}
|
|
243
|
+
bgColor={theme.colors.primary}
|
|
244
|
+
borderColor={theme.colors.primary}
|
|
245
|
+
onClick={() => setOpenModal({ open: true, data: null })}
|
|
246
|
+
/>
|
|
247
|
+
</NoPrintersContainer>
|
|
248
|
+
)}
|
|
249
|
+
</View>
|
|
250
|
+
<OModal
|
|
251
|
+
hideIcons
|
|
252
|
+
entireModal
|
|
253
|
+
customClose
|
|
254
|
+
open={openModal.open}
|
|
255
|
+
style={{ paddingTop: 0, marginTop: 0 }}
|
|
256
|
+
onClose={() => setOpenModal({ open: false, data: null })}
|
|
257
|
+
>
|
|
258
|
+
<PrinterEdition
|
|
259
|
+
printer={openModal.data}
|
|
260
|
+
printersList={printers}
|
|
261
|
+
handleChangePrinter={handleClick}
|
|
262
|
+
onClose={() => setOpenModal({ open: false, data: null })}
|
|
263
|
+
/>
|
|
264
|
+
</OModal>
|
|
265
|
+
</Container>
|
|
266
|
+
)
|
|
267
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
|
+
|
|
3
|
+
export const Container = styled.View`
|
|
4
|
+
margin-bottom: 50px;
|
|
5
|
+
`
|
|
6
|
+
|
|
7
|
+
export const ContainerList = styled.View`
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
width: 100%;
|
|
11
|
+
padding: 5px 5px 5px 0;
|
|
12
|
+
border-bottom-width: 1px;
|
|
13
|
+
border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export const EnabledAutoPrint = styled.View`
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: 20px 0px 10px;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const NoPrintersContainer = styled.View`
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
margin-top: 40px;
|
|
28
|
+
height: 100%;
|
|
29
|
+
flex: 1;
|
|
30
|
+
`
|
|
@@ -72,7 +72,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
72
72
|
|
|
73
73
|
const getProductPrice = (product: any) => {
|
|
74
74
|
let subOptionPrice = 0;
|
|
75
|
-
if (product?.options?.length > 0 && product?.options?.suboptions?.length > 0) {
|
|
75
|
+
if (product?.options?.length > 0 && product?.options[0]?.suboptions?.length > 0) {
|
|
76
76
|
for (const option of product?.options) {
|
|
77
77
|
for (const suboption of option?.suboptions) {
|
|
78
78
|
subOptionPrice += suboption.quantity * suboption.price;
|
|
@@ -118,7 +118,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
118
118
|
|
|
119
119
|
const onTextLayout = useCallback((e: any) => {
|
|
120
120
|
setLengthMore((e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2); //to check the text is more than 2 lines or not
|
|
121
|
-
},[]);
|
|
121
|
+
}, []);
|
|
122
122
|
|
|
123
123
|
return (
|
|
124
124
|
<AccordionSection>
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { View, TouchableOpacity, Platform, StyleSheet } from 'react-native'
|
|
3
|
+
import { useLanguage, useSession, useUtils, Sessions as SessionsController } from 'ordering-components/native'
|
|
4
|
+
import { SessionsParams } from '../../types'
|
|
5
|
+
import { OAlert } from '../../../../../src/components/shared'
|
|
6
|
+
import { OButton, OIcon, OText } from '../shared'
|
|
7
|
+
import { useTheme } from 'styled-components/native'
|
|
8
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
9
|
+
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
SessionsWrapper,
|
|
13
|
+
SessionItem,
|
|
14
|
+
DurationWrapper,
|
|
15
|
+
Container
|
|
16
|
+
} from './styles'
|
|
17
|
+
|
|
18
|
+
export const SessionsUI = (props: SessionsParams) => {
|
|
19
|
+
const {
|
|
20
|
+
navigation,
|
|
21
|
+
sessionsList,
|
|
22
|
+
actionState,
|
|
23
|
+
handleDeleteSession,
|
|
24
|
+
handleDeleteAllSessions
|
|
25
|
+
} = props
|
|
26
|
+
|
|
27
|
+
const [, t] = useLanguage()
|
|
28
|
+
const [{ user }] = useSession()
|
|
29
|
+
const [{ parseDate }] = useUtils()
|
|
30
|
+
const theme = useTheme()
|
|
31
|
+
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
32
|
+
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
33
|
+
|
|
34
|
+
const onDeleteSession = (session: any) => {
|
|
35
|
+
setConfirm({
|
|
36
|
+
open: true,
|
|
37
|
+
title: t('WEB_APPNAME', 'Ordering'),
|
|
38
|
+
content: [t('QUESTION_DELETE_SESSION', 'Are you sure to delete this session?')],
|
|
39
|
+
handleOnAccept: () => {
|
|
40
|
+
handleDeleteSession(session)
|
|
41
|
+
setConfirm({ ...confirm, open: false })
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const onDeleteAllSessions = (isOldUser: any, deleteCurrent: any) => {
|
|
47
|
+
setConfirm({
|
|
48
|
+
open: true,
|
|
49
|
+
title: t('WEB_APPNAME', 'Ordering'),
|
|
50
|
+
content:
|
|
51
|
+
isOldUser
|
|
52
|
+
? [t('QUESTION_ENABLE_ALL_SESSIONS', 'Are you sure to enable all sessions?')]
|
|
53
|
+
: deleteCurrent
|
|
54
|
+
? [t('QUESTION_DELETE_ALL_SESSIONS', 'Are you sure that you want to delete all sessions?')]
|
|
55
|
+
: [t('QUESTION_DELETE_ALL_SESSIONS_EXCEPT_CURRENT', 'Are you sure that you want to delete all sessions except current?')],
|
|
56
|
+
handleOnAccept: () => {
|
|
57
|
+
handleDeleteAllSessions(deleteCurrent)
|
|
58
|
+
setConfirm({ ...confirm, open: false })
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const styles = StyleSheet.create({
|
|
64
|
+
titleGroups: {
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
flexDirection: 'row',
|
|
67
|
+
minHeight: 33,
|
|
68
|
+
},
|
|
69
|
+
btnBackArrow: {
|
|
70
|
+
borderWidth: 0,
|
|
71
|
+
width: 32,
|
|
72
|
+
height: 32,
|
|
73
|
+
tintColor: theme.colors.textGray,
|
|
74
|
+
backgroundColor: theme.colors.clear,
|
|
75
|
+
borderColor: theme.colors.clear,
|
|
76
|
+
shadowColor: theme.colors.clear,
|
|
77
|
+
paddingLeft: 0,
|
|
78
|
+
paddingRight: 0,
|
|
79
|
+
marginTop: Platform.OS === 'ios' ? 30 : 10
|
|
80
|
+
},
|
|
81
|
+
innerPadding: {
|
|
82
|
+
paddingLeft: 10,
|
|
83
|
+
paddingRight: 10
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<Container
|
|
89
|
+
pdng={Platform.OS === 'ios' ? '10px' : '8px'}
|
|
90
|
+
style={styles.innerPadding}
|
|
91
|
+
>
|
|
92
|
+
<View style={styles.titleGroups}>
|
|
93
|
+
<TouchableOpacity onPress={() => goToBack()} style={styles.btnBackArrow}>
|
|
94
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
|
|
95
|
+
</TouchableOpacity>
|
|
96
|
+
</View>
|
|
97
|
+
<OText size={24} style={{ paddingTop: 12 }}>
|
|
98
|
+
{t('SESSIONS', 'Sessions')}
|
|
99
|
+
</OText>
|
|
100
|
+
{user?.session_strategy === 'jwt_session' ? (
|
|
101
|
+
<>
|
|
102
|
+
{sessionsList.loading ? (
|
|
103
|
+
[...Array(5).keys()].map(i => (
|
|
104
|
+
<SessionItem key={i}>
|
|
105
|
+
<Placeholder Animation={Fade}>
|
|
106
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
107
|
+
<View style={{ flex: 1 }}>
|
|
108
|
+
<PlaceholderLine width={40} />
|
|
109
|
+
<PlaceholderLine width={40} />
|
|
110
|
+
</View>
|
|
111
|
+
<PlaceholderLine width={5} />
|
|
112
|
+
</View>
|
|
113
|
+
</Placeholder>
|
|
114
|
+
</SessionItem>
|
|
115
|
+
))
|
|
116
|
+
) : (
|
|
117
|
+
sessionsList.sessions.length > 0 ? (
|
|
118
|
+
<SessionsWrapper>
|
|
119
|
+
{sessionsList.sessions.reverse().map((session: any) => (
|
|
120
|
+
<SessionItem key={session.id}>
|
|
121
|
+
<DurationWrapper>
|
|
122
|
+
<OText>{parseDate(session.created_at)}</OText>
|
|
123
|
+
<OText>{parseDate(session.valid_thru)}</OText>
|
|
124
|
+
</DurationWrapper>
|
|
125
|
+
{session.current && (
|
|
126
|
+
<OText mLeft={15} style={{ flex: 1 }}>({t('CURRENT', 'Current')})</OText>
|
|
127
|
+
)}
|
|
128
|
+
<TouchableOpacity
|
|
129
|
+
onPress={() => onDeleteSession(session)}
|
|
130
|
+
>
|
|
131
|
+
<AntIcon name='close' size={16} color={theme.colors.red} />
|
|
132
|
+
</TouchableOpacity>
|
|
133
|
+
</SessionItem>
|
|
134
|
+
))}
|
|
135
|
+
<OButton
|
|
136
|
+
text={t('DELETE_ALL_SESSIONS', 'Delete all sessions')}
|
|
137
|
+
isDisabled={actionState.loading}
|
|
138
|
+
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
139
|
+
onClick={() => onDeleteAllSessions(false, true)}
|
|
140
|
+
style={{ borderRadius: 7.6, marginTop: 30 }}
|
|
141
|
+
/>
|
|
142
|
+
<OButton
|
|
143
|
+
text={t('DELETE_ALL_SESSIONS_EXCEPT_CURRENT', 'Delete all sessions except current')}
|
|
144
|
+
isDisabled={actionState.loading}
|
|
145
|
+
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
146
|
+
onClick={() => onDeleteAllSessions(false, false)}
|
|
147
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
148
|
+
/>
|
|
149
|
+
</SessionsWrapper>
|
|
150
|
+
) : (
|
|
151
|
+
<OText>{t('YOU_DONT_HAVE_ANY_SESSIONS', 'You don\'t have any sessions')}</OText>
|
|
152
|
+
)
|
|
153
|
+
)}
|
|
154
|
+
</>
|
|
155
|
+
) : (
|
|
156
|
+
<View>
|
|
157
|
+
<OText>
|
|
158
|
+
{t('YOU_DONT_HAVE_ENABLED_THE_SESSIONS', 'You don\'t have enabled the sessions, please active them to have a better control of your sessions.')}
|
|
159
|
+
</OText>
|
|
160
|
+
<OButton
|
|
161
|
+
text={t('ACTIVE_SESSIONS', 'Active sessions')}
|
|
162
|
+
isDisabled={actionState.loading}
|
|
163
|
+
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
164
|
+
onClick={() => onDeleteAllSessions(true, false)}
|
|
165
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
166
|
+
/>
|
|
167
|
+
</View>
|
|
168
|
+
)}
|
|
169
|
+
<OAlert
|
|
170
|
+
open={confirm.open}
|
|
171
|
+
title={confirm.title}
|
|
172
|
+
content={confirm.content}
|
|
173
|
+
onAccept={confirm.handleOnAccept}
|
|
174
|
+
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
175
|
+
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
176
|
+
/>
|
|
177
|
+
</Container>
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const Sessions = (props: SessionsParams) => {
|
|
182
|
+
const sessionsProps = {
|
|
183
|
+
...props,
|
|
184
|
+
UIComponent: SessionsUI
|
|
185
|
+
}
|
|
186
|
+
return <SessionsController {...sessionsProps} />
|
|
187
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import styled from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const SessionsWrapper = styled.View`
|
|
4
|
+
`
|
|
5
|
+
export const SessionItem = styled.View`
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
padding-vertical: 15px;
|
|
10
|
+
border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
|
|
11
|
+
border-bottom-width: 1px;
|
|
12
|
+
`
|
|
13
|
+
export const DurationWrapper = styled.View`
|
|
14
|
+
/* flex-direction: row; */
|
|
15
|
+
`
|
|
16
|
+
|
|
17
|
+
export const Container = styled.View`
|
|
18
|
+
padding-top: ${(props: any) => props.pdng};
|
|
19
|
+
margin-bottom: 50px;
|
|
20
|
+
`
|
|
@@ -149,10 +149,10 @@ const StoresListUI = (props: BusinessesListingParams) => {
|
|
|
149
149
|
width={12}
|
|
150
150
|
height={12}
|
|
151
151
|
color={theme.colors.skyBlue}
|
|
152
|
-
style={{ marginRight: 5
|
|
152
|
+
style={{ marginRight: 5 }}
|
|
153
153
|
/>
|
|
154
154
|
<OText size={12}>
|
|
155
|
-
{t('MORE_SETTINGS_GO_TO', 'For more settings go to')}
|
|
155
|
+
{t('MORE_SETTINGS_GO_TO', 'For more settings go to ')}
|
|
156
156
|
</OText>
|
|
157
157
|
<TouchableOpacity onPress={() => { Linking.openURL(t('LINK_MORE_SETTINGS_GO_TO', 'https://app.ordering.co')) }}>
|
|
158
158
|
<OText size={12} color={theme.colors.skyBlue}>
|