ordering-ui-react-native 0.19.0 → 0.19.2-testing

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.19.0",
3
+ "version": "0.19.2-testing",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -215,7 +215,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
215
215
  status: 7,
216
216
  },
217
217
  rejectByBusiness: {
218
- comment: comments,
218
+ reasons: comments,
219
219
  status: 5,
220
220
  },
221
221
  acceptByDriver: {
@@ -223,22 +223,22 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
223
223
  status: 8,
224
224
  },
225
225
  rejectByDriver: {
226
- comment: comments,
226
+ reasons: comments,
227
227
  status: 6,
228
228
  reject_reason: rejectReason
229
229
  },
230
230
  pickupFailedByDriver: {
231
- comment: comments,
231
+ reasons: comments,
232
232
  status: 10,
233
233
  reject_reason: rejectReason
234
234
  },
235
235
  deliveryFailedByDriver: {
236
- comment: comments,
236
+ reasons: comments,
237
237
  status: 12,
238
238
  reject_reason: rejectReason
239
239
  },
240
240
  orderNotReady: {
241
- comment: comments,
241
+ reasons: comments,
242
242
  status: 14,
243
243
  reject_reason: rejectReason
244
244
  },
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { RefreshControl, ScrollView, View } from 'react-native'
3
3
  import { OText } from '../shared'
4
- import { useLanguage, useSession } from 'ordering-components/native'
4
+ import { useLanguage, useSession, useUtils } from 'ordering-components/native'
5
5
  import { DayContainer } from './styles'
6
6
  import { useTheme } from 'styled-components/native'
7
7
  export const DriverSchedule = (props: any) => {
@@ -9,6 +9,7 @@ export const DriverSchedule = (props: any) => {
9
9
  const [, t] = useLanguage()
10
10
  const theme = useTheme()
11
11
  const [, { refreshUserInfo }] = useSession()
12
+ const [{ parseDate }] = useUtils()
12
13
  const [refreshing] = useState(false);
13
14
  const [driverSchedule, setDriverSchedule] = useState([]);
14
15
 
@@ -22,6 +23,12 @@ export const DriverSchedule = (props: any) => {
22
23
  t('SATURDAY_ABBREVIATION', 'Sat')
23
24
  ]
24
25
 
26
+ const getNextDate = (day) => {
27
+ const now = new Date()
28
+ now.setDate(now.getDate() + (day + (7 - now.getDay())) % 7)
29
+ return now
30
+ }
31
+
25
32
  const scheduleFormatted = ({ hour, minute }: any) => {
26
33
  const checkTime = (val: number) => val < 10 ? `0${val}` : val
27
34
  return `${checkTime(hour)}:${checkTime(minute)}`
@@ -66,8 +73,11 @@ export const DriverSchedule = (props: any) => {
66
73
  <View style={{ padding: 30 }}>
67
74
  {driverSchedule.map((item: any, i: number) => (
68
75
  <DayContainer key={daysOfWeek[i]}>
69
- <OText style={{ width: '20%' }} size={22} weight={700}>{daysOfWeek[i]}</OText>
70
- <View style={{ width: '80%', alignItems: 'center' }}>
76
+ <View style={{ width: '30%' }}>
77
+ <OText size={22} weight={700}>{daysOfWeek[i]}</OText>
78
+ <OText size={14}>{parseDate(getNextDate(i), { outputFormat: 'YYYY-MM-DD' })}</OText>
79
+ </View>
80
+ <View style={{ width: '70%', alignItems: 'center' }}>
71
81
  <>
72
82
  {item?.enabled ? (
73
83
  <View>
@@ -45,7 +45,7 @@ const NewOrderNotificationUI = (props: any) => {
45
45
  },
46
46
  }
47
47
 
48
- const notificationSound = new Sound(theme.sounds.notification, '', () => { });
48
+ const notificationSound = new Sound('https://cdn.freesound.org/previews/81/81205_1274366-lq.mp3', '', () => {});
49
49
 
50
50
  let _timeout: any = null
51
51
  let times = 0
@@ -339,6 +339,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
339
339
  }
340
340
  };
341
341
 
342
+ const customerName = `${order?.customer?.name ?? ''} ${order?.customer?.middle_name ?? ''} ${order?.customer?.lastname ?? ''} ${order?.customer?.second_lastname ?? ''
343
+ }`?.replace(' ', ' ')?.trim() ?? ''
344
+
342
345
  return (
343
346
  <>
344
347
  <Content>
@@ -373,8 +376,8 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
373
376
 
374
377
  <OText style={{ marginBottom: 5 }}>
375
378
  {`${t('DELIVERY_DATE', 'Delivery Date')}: ${order?.delivery_datetime_utc
376
- ? parseDate(order?.delivery_datetime_utc)
377
- : parseDate(order?.delivery_datetime, { utc: false })
379
+ ? parseDate(order?.delivery_datetime_utc)
380
+ : parseDate(order?.delivery_datetime, { utc: false })
378
381
  }`}
379
382
  </OText>
380
383
 
@@ -400,9 +403,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
400
403
  adjustsFontSizeToFit
401
404
  ellipsizeMode="tail"
402
405
  color={theme.colors.textGray}>
403
- {`${t('FULL_NAME', 'Full Name')}: ${order?.customer?.name} ${order?.customer?.middle_name
404
- } ${order?.customer?.lastname} ${order?.customer?.second_lastname
405
- }`}
406
+ {`${t('FULL_NAME', 'Full Name')}: ${customerName}`}
406
407
  </OText>
407
408
 
408
409
  <OText
@@ -279,7 +279,7 @@ const CheckoutUI = (props: any) => {
279
279
  const checkValidationFields = () => {
280
280
  setUserErrors([])
281
281
  const errors = []
282
- const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
282
+ const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
283
283
  const _requiredFields: any = []
284
284
 
285
285
  Object.values(validationFields?.fields?.checkout).map((field: any) => {