ordering-ui-react-native 0.17.55-release → 0.17.56-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.55-release",
3
+ "version": "0.17.56-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -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>
@@ -13,7 +13,8 @@ export const CartContent = (props: any) => {
13
13
  const {
14
14
  carts,
15
15
  isOrderStateCarts,
16
- onNavigationRedirect
16
+ onNavigationRedirect,
17
+ singleBusiness
17
18
  } = props
18
19
 
19
20
  const theme = useTheme();
@@ -156,7 +157,7 @@ export const CartContent = (props: any) => {
156
157
  btnStyle={{ borderRadius: 8 }}
157
158
  content={t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
158
159
  btnTitle={t('START_SHOPPING', 'Start shopping')}
159
- onClickButton={() => onNavigationRedirect('BusinessList')}
160
+ onClickButton={() => singleBusiness ? onNavigationRedirect('Business') : onNavigationRedirect('BusinessList')}
160
161
  />
161
162
  </CCNotCarts>
162
163
  )}
@@ -148,18 +148,6 @@ export const MyOrders = (props: any) => {
148
148
  )}
149
149
  {selectedOption === 'orders' && (
150
150
  <>
151
- {ordersLength?.preordersLength > 0 && (
152
- <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
153
- <OrdersOption
154
- {...props}
155
- preOrders
156
- ordersLength={ordersLength}
157
- setOrdersLength={setOrdersLength}
158
- setRefreshOrders={setRefreshOrders}
159
- refreshOrders={refreshOrders}
160
- />
161
- </View>
162
- )}
163
151
  <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
164
152
  <OrdersOption
165
153
  {...props}
@@ -51,7 +51,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
51
51
  businesses,
52
52
  businessPaginationProps,
53
53
  handleUpdateProducts,
54
- handleUpdateBusinesses
54
+ handleUpdateBusinesses,
55
+ businessId
55
56
  } = props
56
57
 
57
58
  const theme = useTheme();
@@ -207,7 +208,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
207
208
  btnStyle={{ borderRadius: 8 }}
208
209
  content={t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
209
210
  btnTitle={t('ORDER_NOW', 'Order now')}
210
- onClickButton={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
211
+ onClickButton={() => onNavigationRedirect && (businessId ? onNavigationRedirect('Business') : onNavigationRedirect('BusinessList'))}
211
212
  />
212
213
  </NoOrdersWrapper>
213
214
  )}
@@ -392,6 +392,7 @@ export interface OrdersOptionParams {
392
392
  BusinessControllerSkeletons?: any,
393
393
  businessPaginationProps?: any,
394
394
  businesses?: any
395
+ businessId?: any;
395
396
  }
396
397
  export interface ActiveOrdersParams {
397
398
  orders?: any,