ordering-ui-react-native 0.22.5 → 0.22.7

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,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.22.05",
3
+ "version": "0.22.07",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -77,6 +77,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
77
77
  const [printerSettings, setPrinterSettings] = useState('')
78
78
  const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
79
79
 
80
+ const orderToComplete = [4,20,21]
81
+
80
82
  if (order?.status === 7 || order?.status === 4) {
81
83
  if (drivers?.length > 0 && drivers) {
82
84
  drivers.forEach((driver: any) => {
@@ -130,7 +132,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
130
132
  if (props.handleChangeOrderStatus) {
131
133
  const order: any = await props.handleChangeOrderStatus(status, isAcceptOrReject)
132
134
 
133
- if (order?.status !== 0 && autoPrintEnabled && printerSettings) {
135
+ if (order?.status === 7 && autoPrintEnabled && printerSettings) {
134
136
  handleViewSummaryOrder()
135
137
  }
136
138
  }
@@ -310,23 +312,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
310
312
  const printAction = async (printerSettings: any, commands: any) => {
311
313
  try {
312
314
  var printResult = await StarPRNT.print(printerSettings?.emulation, commands, printerSettings?.portName);
313
- Alert.alert(
314
- t('PRINT_SUCCESS_TITLE', 'Print Success'),
315
- t('PRINT_SUCCESS_SUBTITLE', `Go check your _printer_ printer!`).replace('_printer_', printerSettings?.model),
316
- [
317
- {text: 'OK', onPress: () => null},
318
- ],
319
- { cancelable: false }
320
- )
315
+ showToast(ToastType.Info, t('ORDER_PRINTED_SUCCESS', 'Order printed'), 1000)
321
316
  } catch (e) {
322
- Alert.alert(
323
- t('PRINT_FAIL_TITLE', 'Connection Failed'),
324
- t('PRINT_FAIL_SUBTITLE', 'Make sure your Star Printer is turned on and have thermal paper in it.'),
325
- [
326
- {text: 'OK', onPress: () => null},
327
- ],
328
- { cancelable: false }
329
- )
317
+ showToast(ToastType.Error, t('ORDER_PRINTED_FAILED', 'Order not printed, connection failed'), 1000)
330
318
  }
331
319
  }
332
320
 
@@ -667,7 +655,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
667
655
  disabled={loading}
668
656
  />
669
657
  )}
670
- {order?.status === 4 && ![1].includes(order?.delivery_type) && (
658
+ {orderToComplete.includes(order?.status) && ![1].includes(order?.delivery_type) && (
671
659
  <FloatingButton
672
660
  btnText={t(
673
661
  'ORDER_NOT_PICKEDUP_BY_CUSTOMER',