ordering-ui-react-native 0.23.17 → 0.23.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Platform } from 'react-native'
|
|
1
2
|
import { useConfig, useUtils, useLanguage} from 'ordering-components/native'
|
|
2
3
|
|
|
3
4
|
import { verifyDecimals, getProductPrice } from '../../utils';
|
|
@@ -70,14 +71,14 @@ export const usePrinterCommands = () => {
|
|
|
70
71
|
list.push(`${product?.quantity} ${product?.name} \t ${parsePrice(product.total ?? getProductPrice(product))}${endLine}`)
|
|
71
72
|
|
|
72
73
|
if (product?.ingredients?.length) {
|
|
73
|
-
list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: 10 } })
|
|
74
|
+
list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
74
75
|
product?.ingredients?.map((ingredient: any) => {
|
|
75
|
-
list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: 10 })
|
|
76
|
+
list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: Platform.OS === 'ios' ? 10 : 18 })
|
|
76
77
|
})
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
product.options?.map((option: any) => {
|
|
80
|
-
list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: 10 } })
|
|
81
|
+
list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
81
82
|
|
|
82
83
|
option.suboptions?.map((suboption: any) => {
|
|
83
84
|
const { quantity, name, position, price } = suboption
|
|
@@ -88,13 +89,13 @@ export const usePrinterCommands = () => {
|
|
|
88
89
|
: `${quantity} x ${name} +${parsePrice(price)}`
|
|
89
90
|
: 'No'
|
|
90
91
|
|
|
91
|
-
list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: 10 } })
|
|
92
|
+
list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
92
93
|
})
|
|
93
94
|
})
|
|
94
95
|
|
|
95
96
|
if (product.comment) {
|
|
96
|
-
list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: 10 } })
|
|
97
|
-
list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: 10 } })
|
|
97
|
+
list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
98
|
+
list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
list.push('_separator_')
|
|
@@ -154,18 +155,18 @@ export const usePrinterCommands = () => {
|
|
|
154
155
|
const jumpLine = isAppendMode ? '\n' : ' '
|
|
155
156
|
const endLine = isAppendMode ? '\n' : ''
|
|
156
157
|
|
|
157
|
-
const textProps = { fontSize:
|
|
158
|
+
const textProps = { fontSize: 22 }
|
|
158
159
|
|
|
159
160
|
const appends: any = [
|
|
160
|
-
{ text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: 16 } },
|
|
161
|
+
{ text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 16 : 24 } },
|
|
161
162
|
jumpLine,
|
|
162
163
|
`${order.orderStatus}${endLine}`,
|
|
163
|
-
{ text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: 14 } },
|
|
164
|
-
{ text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: 14 } },
|
|
165
|
-
`${!!order?.delivery_option ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}
|
|
166
|
-
`${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${endLine}`,
|
|
164
|
+
{ text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } },
|
|
165
|
+
{ text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } },
|
|
166
|
+
`${!!order?.delivery_option ? { text: `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } } : ''}`,
|
|
167
|
+
{ text: `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } },
|
|
167
168
|
'_separator_',
|
|
168
|
-
{ text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: 14 } },
|
|
169
|
+
{ text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
|
|
169
170
|
`${t('FULL_NAME', 'Full Name')}: ${customerName(order)}${endLine}`,
|
|
170
171
|
`${t('EMAIL', 'Email')}: ${order?.customer?.email}${endLine}`,
|
|
171
172
|
`${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}${endLine}` : ''}`,
|
|
@@ -174,7 +175,7 @@ export const usePrinterCommands = () => {
|
|
|
174
175
|
`${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}${endLine}` : ''}`,
|
|
175
176
|
`${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}${endLine}` : ''}`,
|
|
176
177
|
'_separator_',
|
|
177
|
-
{ text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: 14 } },
|
|
178
|
+
{ text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
|
|
178
179
|
`${order?.business?.name}${endLine}`,
|
|
179
180
|
`${order?.business?.email}${endLine}`,
|
|
180
181
|
`${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}${endLine}` : ''}`,
|
|
@@ -182,7 +183,7 @@ export const usePrinterCommands = () => {
|
|
|
182
183
|
`${t('ADDRESS', 'Address')}: ${order?.business?.address}${endLine}`,
|
|
183
184
|
`${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}${endLine}` : ''}`,
|
|
184
185
|
'_separator_',
|
|
185
|
-
{ text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: 14 } },
|
|
186
|
+
{ text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
|
|
186
187
|
`${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}${endLine}` : ''}`,
|
|
187
188
|
...generateProductsText(order, { endLine }),
|
|
188
189
|
`${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}${endLine}`,
|
|
@@ -204,7 +205,7 @@ export const usePrinterCommands = () => {
|
|
|
204
205
|
...commands,
|
|
205
206
|
...appends.map((append: any) => {
|
|
206
207
|
return append === '_separator_'
|
|
207
|
-
? { [printMode]:
|
|
208
|
+
? { [printMode]: `-------------------------------------${endLine}` }
|
|
208
209
|
: {
|
|
209
210
|
[printMode]: replaceChars(append?.text ?? append),
|
|
210
211
|
...textProps,
|
|
@@ -102,7 +102,7 @@ export const PrinterSettings = (props: any) => {
|
|
|
102
102
|
type: type ?? _currentPrinter?.type ?? 1,
|
|
103
103
|
ip: ip ?? _currentPrinter?.ip ?? '',
|
|
104
104
|
portName: (type ?? _currentPrinter?.type) === 1 || !ip
|
|
105
|
-
? item.portName1 ?? _currentPrinter?.portName1
|
|
105
|
+
? item?.bt ?? item.portName1 ?? _currentPrinter?.portName1
|
|
106
106
|
: `TCP:${ip}`
|
|
107
107
|
}
|
|
108
108
|
edit ? (_printers[idx] = _item) : _printers.push(_item)
|