ordering-ui-react-native 0.22.13 → 0.22.15
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
|
@@ -137,7 +137,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
137
137
|
const deliveryDate = () => {
|
|
138
138
|
const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
|
|
139
139
|
const currentDate = new Date();
|
|
140
|
-
const receivedDate: any = new Date(
|
|
140
|
+
const receivedDate: any = new Date(order?.delivery_datetime);
|
|
141
141
|
|
|
142
142
|
const formattedDate = receivedDate <= currentDate
|
|
143
143
|
? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
|
|
@@ -52,12 +52,13 @@ export const usePrinterCommands = () => {
|
|
|
52
52
|
const customerName = (order: any) => `${order?.customer?.name ?? ''} ${order?.customer?.middle_name ?? ''} ${order?.customer?.lastname ?? ''} ${order?.customer?.second_lastname ?? ''}`?.replace(' ', ' ')?.trim() ?? ''
|
|
53
53
|
|
|
54
54
|
const deliveryDate = (order: any) => {
|
|
55
|
-
const dateString = order?.delivery_datetime_utc
|
|
55
|
+
const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
|
|
56
56
|
const currentDate = new Date();
|
|
57
|
-
const receivedDate: any = new Date(
|
|
57
|
+
const receivedDate: any = new Date(order?.delivery_datetime);
|
|
58
|
+
|
|
58
59
|
const formattedDate = receivedDate <= currentDate
|
|
59
|
-
? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(
|
|
60
|
-
: parseDate(
|
|
60
|
+
? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
|
|
61
|
+
: parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
|
|
61
62
|
return formattedDate
|
|
62
63
|
}
|
|
63
64
|
|
|
@@ -123,6 +124,29 @@ export const usePrinterCommands = () => {
|
|
|
123
124
|
return list
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
const replaceChars = (string: string) => {
|
|
128
|
+
const accents: any = {
|
|
129
|
+
'á': 'a',
|
|
130
|
+
'é': 'e',
|
|
131
|
+
'í': 'i',
|
|
132
|
+
'ó': 'o',
|
|
133
|
+
'ú': 'u',
|
|
134
|
+
'Á': 'A',
|
|
135
|
+
'É': 'E',
|
|
136
|
+
'Í': 'I',
|
|
137
|
+
'Ó': 'O',
|
|
138
|
+
'Ú': 'U',
|
|
139
|
+
'ü': 'u',
|
|
140
|
+
'Ü': 'U',
|
|
141
|
+
'ñ': 'n',
|
|
142
|
+
'Ñ': 'N',
|
|
143
|
+
"'": '',
|
|
144
|
+
"’": '',
|
|
145
|
+
"`": '',
|
|
146
|
+
};
|
|
147
|
+
return string.replace(/[áéíóúÁÉÍÓÚüÜñÑ'’`]/g, (match: any) => accents[match])
|
|
148
|
+
}
|
|
149
|
+
|
|
126
150
|
const generateCommands = (order: any, printMode: string = 'append') => {
|
|
127
151
|
let commands: any = [];
|
|
128
152
|
|
|
@@ -182,7 +206,7 @@ export const usePrinterCommands = () => {
|
|
|
182
206
|
return append === '_separator_'
|
|
183
207
|
? { [printMode]: `---------------------------------------${endLine}` }
|
|
184
208
|
: {
|
|
185
|
-
[printMode]: append?.text ?? append,
|
|
209
|
+
[printMode]: replaceChars(append?.text ?? append),
|
|
186
210
|
...textProps,
|
|
187
211
|
...append?.props
|
|
188
212
|
}
|
|
@@ -101,7 +101,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
101
101
|
const deliveryDate = (order: any) => {
|
|
102
102
|
const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
|
|
103
103
|
const currentDate = new Date();
|
|
104
|
-
const receivedDate: any = new Date(
|
|
104
|
+
const receivedDate: any = new Date(order?.delivery_datetime);
|
|
105
105
|
|
|
106
106
|
const formattedDate = receivedDate <= currentDate
|
|
107
107
|
? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
|