ordering-ui-react-native 0.11.37 → 0.11.41

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.
Files changed (28) hide show
  1. package/package.json +2 -1
  2. package/src/theme.json +0 -1
  3. package/themes/business/index.tsx +18 -0
  4. package/themes/business/src/components/OrdersOption/index.tsx +186 -13
  5. package/themes/business/src/components/OrdersOption/styles.tsx +31 -1
  6. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +51 -0
  7. package/themes/business/src/components/OrdersOptionBusiness/styles.tsx +8 -0
  8. package/themes/business/src/components/OrdersOptionCity/index.tsx +52 -0
  9. package/themes/business/src/components/OrdersOptionCity/styles.tsx +8 -0
  10. package/themes/business/src/components/OrdersOptionDate/index.tsx +52 -0
  11. package/themes/business/src/components/OrdersOptionDate/styles.tsx +8 -0
  12. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +35 -0
  13. package/themes/business/src/components/OrdersOptionDelivery/styles.tsx +8 -0
  14. package/themes/business/src/components/OrdersOptionDriver/index.tsx +50 -0
  15. package/themes/business/src/components/OrdersOptionDriver/styles.tsx +8 -0
  16. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +49 -0
  17. package/themes/business/src/components/OrdersOptionPaymethod/styles.tsx +8 -0
  18. package/themes/business/src/components/OrdersOptionStatus/index.tsx +46 -0
  19. package/themes/business/src/components/OrdersOptionStatus/styles.tsx +8 -0
  20. package/themes/business/src/components/shared/ODropDown.tsx +195 -0
  21. package/themes/business/src/components/shared/ODropDownCalendar.tsx +328 -0
  22. package/themes/business/src/components/shared/index.tsx +4 -0
  23. package/themes/business/src/types/index.tsx +2 -0
  24. package/themes/doordash/src/components/Messages/index.tsx +45 -26
  25. package/themes/original/src/components/DriverTips/styles.tsx +4 -3
  26. package/themes/original/src/components/LoginForm/index.tsx +14 -3
  27. package/themes/original/src/components/Messages/index.tsx +48 -30
  28. package/themes/original/src/components/ProductForm/index.tsx +24 -24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.11.37",
3
+ "version": "0.11.41",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -66,6 +66,7 @@
66
66
  "react-native-awesome-loading": "^1.0.15",
67
67
  "react-native-background-timer": "^2.4.1",
68
68
  "react-native-bootsplash": "^3.2.3",
69
+ "react-native-calendar-picker": "^7.1.2",
69
70
  "react-native-country-picker-modal": "^2.0.0",
70
71
  "react-native-credit-card-input": "^0.4.1",
71
72
  "react-native-document-picker": "^5.2.0",
package/src/theme.json CHANGED
@@ -125,4 +125,3 @@
125
125
  }
126
126
  }
127
127
  }
128
-
@@ -15,6 +15,13 @@ import { OrderMessage } from './src/components/OrderMessage';
15
15
  import { OrderDetailsBusiness } from './src/components/OrderDetails/Business';
16
16
  import { OrderDetailsDelivery } from './src/components/OrderDetails/Delivery';
17
17
  import { OrdersOption } from './src/components/OrdersOption';
18
+ import { OrdersOptionStatus } from './src/components/OrdersOptionStatus';
19
+ import { OrdersOptionBusiness } from './src/components/OrdersOptionBusiness';
20
+ import { OrdersOptionCity } from './src/components/OrdersOptionCity';
21
+ import { OrdersOptionDate } from './src/components/OrdersOptionDate';
22
+ import { OrdersOptionDelivery } from './src/components/OrdersOptionDelivery';
23
+ import { OrdersOptionDriver } from './src/components/OrdersOptionDriver';
24
+ import { OrdersOptionPaymethod } from './src/components/OrdersOptionPaymethod';
18
25
  import { OrderSummary } from './src/components/OrderSummary';
19
26
  import { PhoneInputNumber } from './src/components/PhoneInputNumber';
20
27
  import { PreviousMessages } from './src/components/PreviousMessages';
@@ -39,6 +46,8 @@ import {
39
46
  OAlert,
40
47
  OModal,
41
48
  OLink,
49
+ ODropDown,
50
+ ODropDownCalendar
42
51
  } from './src/components/shared';
43
52
 
44
53
  //layouts
@@ -69,6 +78,13 @@ export {
69
78
  OrderDetailsDelivery,
70
79
  OrderMessage,
71
80
  OrdersOption,
81
+ OrdersOptionStatus,
82
+ OrdersOptionBusiness,
83
+ OrdersOptionCity,
84
+ OrdersOptionDate,
85
+ OrdersOptionDelivery,
86
+ OrdersOptionDriver,
87
+ OrdersOptionPaymethod,
72
88
  OrderSummary,
73
89
  PhoneInputNumber,
74
90
  PreviousMessages,
@@ -91,6 +107,8 @@ export {
91
107
  OModal,
92
108
  OText,
93
109
  OTextarea,
110
+ ODropDown,
111
+ ODropDownCalendar,
94
112
  //layouts
95
113
  Container,
96
114
  SafeAreaContainer,
@@ -1,18 +1,35 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
2
  import { View, Pressable, StyleSheet, ScrollView, RefreshControl } from 'react-native';
3
- import { useLanguage, OrderListGroups } from 'ordering-components/native';
3
+ import { useLanguage, useUtils, OrderListGroups } from 'ordering-components/native';
4
4
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
5
5
  import FeatherIcon from 'react-native-vector-icons/Feather';
6
+ import FontistoIcon from 'react-native-vector-icons/Fontisto'
7
+ import { useTheme } from 'styled-components/native';
6
8
  import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
7
9
 
8
- import { useTheme } from 'styled-components/native';
9
- import { OText, OButton } from '../shared';
10
+ import { OText, OButton, OModal, OIconButton, OInput } from '../shared';
10
11
  import { NotFoundSource } from '../NotFoundSource';
11
- import { FiltersTab, TabsContainer, Tag } from './styles';
12
+ import {
13
+ FiltersTab,
14
+ TabsContainer,
15
+ Tag,
16
+ IconWrapper,
17
+ ModalContainer,
18
+ ModalTitle,
19
+ FilterBtnWrapper
20
+ } from './styles';
12
21
  import { PreviousOrders } from '../PreviousOrders';
13
22
  import { OrdersOptionParams } from '../../types';
14
23
 
15
24
  import GestureRecognizer from 'react-native-swipe-gestures';
25
+ import ODropDown from '../shared/ODropDown';
26
+ import { OrdersOptionStatus } from '../OrdersOptionStatus'
27
+ import { OrdersOptionCity } from '../OrdersOptionCity';
28
+ import { OrdersOptionBusiness } from '../OrdersOptionBusiness';
29
+ import { OrdersOptionDelivery } from '../OrdersOptionDelivery';
30
+ import { OrdersOptionPaymethod } from '../OrdersOptionPaymethod';
31
+ import { OrdersOptionDriver } from '../OrdersOptionDriver';
32
+ import { OrdersOptionDate } from '../OrdersOptionDate';
16
33
 
17
34
  const tabsList: any = {
18
35
  pending: 1,
@@ -47,12 +64,32 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
47
64
  loadOrders,
48
65
  loadMoreOrders,
49
66
  onNavigationRedirect,
67
+ filtered,
68
+ onFiltered,
50
69
  handleClickOrder
51
70
  } = props;
52
71
 
72
+ const defaultSearchList = {
73
+ id: '',
74
+ state: '',
75
+ city: '',
76
+ business: '',
77
+ delivery_type: '',
78
+ paymethod: '',
79
+ driver: '',
80
+ date: {
81
+ from: '',
82
+ to: '',
83
+ type: ''
84
+ }
85
+ }
86
+
53
87
  const theme = useTheme();
54
88
  const [, t] = useLanguage();
89
+ const [{ parseDate }] = useUtils()
55
90
  const [orientationState] = useDeviceOrientation();
91
+ const [openModal, setOpenModal] = useState(false)
92
+ const [search, setSearch] = useState(defaultSearchList)
56
93
 
57
94
  const WIDTH_SCREEN = orientationState?.dimensions?.width
58
95
 
@@ -110,6 +147,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
110
147
  fontWeight: 'normal',
111
148
  fontSize: 18,
112
149
  },
150
+ inputStyle: {
151
+ width: '100%',
152
+ borderWidth: 1,
153
+ borderColor: '#DEE2E6',
154
+ borderRadius: 7.6,
155
+ marginBottom: 24
156
+ }
113
157
  });
114
158
 
115
159
  const scrollRef = useRef() as React.MutableRefObject<ScrollView>;
@@ -135,6 +179,19 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
135
179
  return orderStatus.find((status: any) => status.key === key)?.text;
136
180
  };
137
181
 
182
+ const applyFilters = () => {
183
+ setOrdersGroup({
184
+ ...ordersGroup,
185
+ [currentTabSelected]: {
186
+ ...ordersGroup[currentTabSelected],
187
+ orders: []
188
+ }
189
+ })
190
+ const dateRange = calculateDate(search.date.type, search.date.from, search.date.to)
191
+ onFiltered && onFiltered({...search, date: {...dateRange}})
192
+ setOpenModal(false)
193
+ }
194
+
138
195
  const handleTagSelected = (tag: any) => {
139
196
  const tags = tagsState?.values.includes(tag)
140
197
  ? tagsState?.values.filter((t: any) => t !== tag)
@@ -184,8 +241,40 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
184
241
  nextTab && setCurrentTabSelected(nextTab)
185
242
  }
186
243
 
244
+ const calculateDate = (type: any, from: any, to: any) => {
245
+ switch (type) {
246
+ case 'today':
247
+ const date = parseDate(new Date(), { outputFormat: 'MM/DD/YYYY' })
248
+ return {from: `${date} 00:00:00`, to: `${date} 23:59:59`}
249
+ case 'yesterday':
250
+ const yesterday = new Date()
251
+ yesterday.setDate(yesterday.getDate() - 1)
252
+ const start1 = parseDate(yesterday, { outputFormat: 'MM/DD/YYYY' })
253
+ const end1 = parseDate(new Date(), { outputFormat: 'MM/DD/YYYY' })
254
+ return {from: `${start1} 00:00:00`, to: `${end1} 23:59:59`}
255
+ case 'last_7days':
256
+ const last_7days = new Date()
257
+ last_7days.setDate(last_7days.getDate() - 6)
258
+ const start7 = parseDate(last_7days, { outputFormat: 'MM/DD/YYYY' })
259
+ const end7 = parseDate(new Date(), { outputFormat: 'MM/DD/YYYY' })
260
+ return {from: `${start7} 00:00:00`, to: `${end7} 23:59:59`}
261
+ case 'last_30days':
262
+ const last_30days = new Date()
263
+ last_30days.setDate(last_30days.getDate() - 29)
264
+ const start30 = parseDate(last_30days, { outputFormat: 'MM/DD/YYYY' })
265
+ const end30 = parseDate(new Date(), { outputFormat: 'MM/DD/YYYY' })
266
+ return {from: `${start30} 00:00:00`, to: `${end30} 23:59:59`}
267
+ default:
268
+ const start = from ? `${parseDate(from, { outputFormat: 'MM/DD/YYYY' })} 00:00:00` : ''
269
+ const end = to ? `${parseDate(to, { outputFormat: 'MM/DD/YYYY' })} 23:59:59` : ''
270
+ return {from: start, to: end}
271
+ }
272
+ }
273
+
187
274
  useEffect(() => {
188
275
  setCurrentFilters(null)
276
+ onFiltered && onFiltered(null)
277
+ setSearch(defaultSearchList)
189
278
  scrollRefTab.current?.scrollTo({ animated: true });
190
279
  scrollListRef.current?.scrollTo({ animated: true });
191
280
  scrollRef.current?.scrollTo({ y: 0, animated: true });
@@ -201,12 +290,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
201
290
  <>
202
291
  <View style={styles.header}>
203
292
  <OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
204
- <FeatherIcon
205
- name='refresh-cw'
206
- color={theme.colors.backgroundDark}
207
- size={24}
208
- onPress={() => loadOrders && loadOrders({ newFetch: true })}
209
- />
293
+ <IconWrapper>
294
+ <FeatherIcon
295
+ name='refresh-cw'
296
+ color={theme.colors.backgroundDark}
297
+ size={24}
298
+ onPress={() => loadOrders && loadOrders({ newFetch: true })}
299
+ style={{ marginRight: 20 }}
300
+ />
301
+ <FontistoIcon
302
+ name='search'
303
+ color={theme.colors.backgroundDark}
304
+ size={24}
305
+ onPress={() => setOpenModal(true)}
306
+ />
307
+ </IconWrapper>
210
308
  </View>
211
309
 
212
310
  <FiltersTab>
@@ -323,7 +421,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
323
421
  }
324
422
  >
325
423
  {!currentOrdersGroup.error?.length &&
326
- !!currentOrdersGroup.orders?.length &&
424
+ currentOrdersGroup.orders?.length > 0 &&
327
425
  (
328
426
  <PreviousOrders
329
427
  orders={currentOrdersGroup.orders}
@@ -371,7 +469,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
371
469
  !currentOrdersGroup.loading &&
372
470
  currentOrdersGroup.pagination.totalPages &&
373
471
  currentOrdersGroup.pagination.currentPage < currentOrdersGroup.pagination.totalPages &&
374
- currentOrdersGroup.orders.length &&
472
+ currentOrdersGroup.orders.length > 0 &&
375
473
  (
376
474
  <OButton
377
475
  onClick={handleLoadMore}
@@ -386,7 +484,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
386
484
 
387
485
  {!currentOrdersGroup.loading &&
388
486
  (currentOrdersGroup.error?.length ||
389
- !currentOrdersGroup.orders?.length) &&
487
+ currentOrdersGroup.orders?.length === 0) &&
390
488
  (
391
489
  <NotFoundSource
392
490
  content={
@@ -402,6 +500,81 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
402
500
  )}
403
501
  </ScrollView>
404
502
  {/* </GestureRecognizer> */}
503
+ <OModal open={openModal} entireModal customClose>
504
+ <ModalContainer
505
+ nestedScrollEnabled={true}
506
+ >
507
+ <OIconButton
508
+ icon={theme.images.general.arrow_left}
509
+ borderColor={theme.colors.clear}
510
+ iconColor={theme.colors.backArrow}
511
+ iconStyle={{ width: 20, height: 13 }}
512
+ style={{
513
+ maxWidth: 40,
514
+ height: 35,
515
+ justifyContent: 'flex-end',
516
+ marginBottom: 30,
517
+ marginTop: 30
518
+ }}
519
+ onClick={() => setOpenModal(false)}
520
+ />
521
+ <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
522
+ <OInput
523
+ value={search.id}
524
+ onChange={(value: any) => setSearch({...search, id: value})}
525
+ style={styles.inputStyle}
526
+ placeholder={t('ORDER_NUMBER', 'Order number')}
527
+ autoCorrect={false}
528
+ />
529
+ <OrdersOptionDate
530
+ {...props}
531
+ search={search}
532
+ onSearch={setSearch}
533
+ />
534
+ <OrdersOptionStatus
535
+ {...props}
536
+ search={search}
537
+ onSearch={setSearch}
538
+ />
539
+ <OrdersOptionCity
540
+ {...props}
541
+ search={search}
542
+ onSearch={setSearch}
543
+ />
544
+ <OrdersOptionBusiness
545
+ {...props}
546
+ search={search}
547
+ onSearch={setSearch}
548
+ />
549
+ <OrdersOptionDelivery
550
+ {...props}
551
+ search={search}
552
+ onSearch={setSearch}
553
+ />
554
+ <OrdersOptionPaymethod
555
+ {...props}
556
+ search={search}
557
+ onSearch={setSearch}
558
+ />
559
+ <OrdersOptionDriver
560
+ {...props}
561
+ search={search}
562
+ onSearch={setSearch}
563
+ />
564
+ <OButton
565
+ text={t('SEARCH', 'Search')}
566
+ textStyle={{ color: theme.colors.white }}
567
+ imgRightSrc={null}
568
+ style={{
569
+ borderRadius: 7.6,
570
+ marginBottom: 70,
571
+ marginTop: 60,
572
+ zIndex: 12
573
+ }}
574
+ onClick={applyFilters}
575
+ />
576
+ </ModalContainer>
577
+ </OModal>
405
578
  </>
406
579
  );
407
580
  };
@@ -1,6 +1,6 @@
1
1
  import styled from 'styled-components/native';
2
2
 
3
- export const FiltersTab = styled.View`
3
+ export const FiltersTab = styled.ScrollView`
4
4
  margin-bottom: 20px;
5
5
  `;
6
6
 
@@ -22,3 +22,33 @@ export const Tag = styled.Pressable`
22
22
  border-radius: 50px;
23
23
  margin-right: 15px;
24
24
  `;
25
+
26
+ export const IconWrapper = styled.View`
27
+ flex-direction: row;
28
+ align-items: center;
29
+ `
30
+
31
+ export const ModalContainer = styled.ScrollView`
32
+ padding: 20px 40px 10px 40px;
33
+ `
34
+
35
+ export const ModalTitle = styled.Text`
36
+ font-family: Poppins;
37
+ font-style: normal;
38
+ font-weight: 600;
39
+ font-size: 20px;
40
+ color: ${(props: any) => props.theme.colors.textGray};
41
+ text-transform: capitalize;
42
+ margin-bottom: 24px;
43
+ `
44
+
45
+ export const FilterBtnWrapper = styled.TouchableOpacity`
46
+ background-color: ${(props: any) => props.theme.colors.inputDisabled};
47
+ border-radius: 7.6px;
48
+ margin-vertical: 5px;
49
+ padding: 15px 20px;
50
+ flex-direction: row;
51
+ align-items: center;
52
+ justify-content: space-between;
53
+ margin-bottom: 24px;
54
+ `
@@ -0,0 +1,51 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useLanguage } from 'ordering-components/native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { Container } from './styles';
5
+ import ODropDown from '../shared/ODropDown';
6
+ import { BusinessList as BusinessListController } from 'ordering-components/native'
7
+ import { Platform } from 'react-native'
8
+
9
+ export const OrdersOptionBusinessUI = (props: any) => {
10
+ const {
11
+ search,
12
+ onSearch,
13
+ businessesList
14
+ } = props
15
+
16
+ const theme = useTheme();
17
+ const [, t] = useLanguage();
18
+ const [optionsList, setOptionsList] = useState([])
19
+
20
+ useEffect(() => {
21
+ const businesses: any = []
22
+ for (const business of businessesList?.businesses) {
23
+ businesses.push({value: business.id, content: business.name})
24
+ }
25
+ setOptionsList(businesses)
26
+ }, [businessesList?.businesses])
27
+
28
+ return (
29
+ <Container isIos={Platform.OS === 'ios'}>
30
+ <ODropDown
31
+ options={optionsList}
32
+ defaultValue={search.business}
33
+ onSelect={(option: any) => onSearch({ ...search, business: option })}
34
+ isModal
35
+ bgcolor={theme.colors.inputDisabled}
36
+ textcolor={theme.colors.unselectText}
37
+ placeholder={t('SELECT_BUSINESS', 'Select Business')}
38
+ dropViewMaxHeight={200}
39
+ />
40
+ </Container>
41
+ );
42
+ };
43
+
44
+ export const OrdersOptionBusiness = (props: any) => {
45
+ const ordersOptionBusinessProps = {
46
+ ...props,
47
+ propsToFetch: ['id', 'name'],
48
+ UIComponent: OrdersOptionBusinessUI
49
+ };
50
+ return <BusinessListController {...ordersOptionBusinessProps} />
51
+ };
@@ -0,0 +1,8 @@
1
+ import styled, { css } from 'styled-components/native';
2
+
3
+ export const Container = styled.View`
4
+ margin-bottom: 24px;
5
+ ${(props: any) => props.isIos && css`
6
+ z-index: 17;
7
+ `}
8
+ `;
@@ -0,0 +1,52 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useLanguage } from 'ordering-components/native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { Container } from './styles';
5
+ import ODropDown from '../shared/ODropDown';
6
+ import { MainSearch as MainSearchController } from 'ordering-components/native'
7
+ import { Platform } from 'react-native';
8
+
9
+ export const OrdersOptionCityUI = (props: any) => {
10
+ const {
11
+ search,
12
+ onSearch,
13
+ allListValues
14
+ } = props
15
+
16
+ const theme = useTheme();
17
+ const [, t] = useLanguage();
18
+ const [optionsList, setOptionsList] = useState([])
19
+
20
+ useEffect(() => {
21
+ const cities: any = []
22
+ for (const country of allListValues?.countries) {
23
+ for (const city of country.cities) {
24
+ cities.push({value: city.id, content: city.name})
25
+ }
26
+ }
27
+ setOptionsList(cities)
28
+ }, [allListValues?.countries])
29
+
30
+ return (
31
+ <Container isIos={Platform.OS === 'ios'}>
32
+ <ODropDown
33
+ options={optionsList}
34
+ defaultValue={search.city}
35
+ onSelect={(option: any) => onSearch({ ...search, city: option })}
36
+ isModal
37
+ bgcolor={theme.colors.inputDisabled}
38
+ textcolor={theme.colors.unselectText}
39
+ placeholder={t('SELECT_CITY', 'Select City')}
40
+ dropViewMaxHeight={200}
41
+ />
42
+ </Container>
43
+ );
44
+ };
45
+
46
+ export const OrdersOptionCity = (props: any) => {
47
+ const ordersOptionCityProps = {
48
+ ...props,
49
+ UIComponent: OrdersOptionCityUI
50
+ };
51
+ return <MainSearchController {...ordersOptionCityProps} />;
52
+ };
@@ -0,0 +1,8 @@
1
+ import styled, { css } from 'styled-components/native';
2
+
3
+ export const Container = styled.View`
4
+ margin-bottom: 24px;
5
+ ${(props: any) => props.isIos && css`
6
+ z-index: 18;
7
+ `}
8
+ `;
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { useLanguage } from 'ordering-components/native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { Container } from './styles';
5
+ import ODropDownCalendar from '../shared/ODropDownCalendar';
6
+ import { Platform } from 'react-native'
7
+
8
+ export const OrdersOptionDate = (props: any) => {
9
+ const {
10
+ search,
11
+ onSearch
12
+ } = props
13
+
14
+ const theme = useTheme();
15
+ const [, t] = useLanguage();
16
+ const optionsList: any = [
17
+ { value: 'today', content: t('TODAY', 'Today') },
18
+ { value: 'yesterday', content: t('YESTERDAY', 'Yesterday') },
19
+ { value: 'last_7days', content: t('LAST_7_DAYS', 'Last 7 days') },
20
+ { value: 'last_30days', content: t('LAST_30_DAYS', 'Last 30 days') }
21
+ ]
22
+
23
+ const handleChangeOption = (option: any) => {
24
+ if (option === 'calendar') {
25
+ onSearch({...search, date: {...search.date, type: option}})
26
+ } else {
27
+ onSearch({...search, date: {from: '', to: '', type: option}})
28
+ }
29
+ }
30
+
31
+ const handleChangeDate = (from: any, to: any) => {
32
+ onSearch({...search, date: {...search.date, from: from, to: to}})
33
+ }
34
+
35
+ return (
36
+ <Container isIos={Platform.OS === 'ios'}>
37
+ <ODropDownCalendar
38
+ options={optionsList}
39
+ defaultValue={search.date.type}
40
+ onSelect={(option: any) => handleChangeOption(option)}
41
+ isModal
42
+ bgcolor={theme.colors.inputDisabled}
43
+ textcolor={theme.colors.unselectText}
44
+ placeholder={t('SELECT_DATE', 'Select Date')}
45
+ dropViewMaxHeight={500}
46
+ isCalendar
47
+ rangeDate={search.date}
48
+ handleChangeDate={handleChangeDate}
49
+ />
50
+ </Container>
51
+ );
52
+ };
@@ -0,0 +1,8 @@
1
+ import styled, { css } from 'styled-components/native';
2
+
3
+ export const Container = styled.View`
4
+ margin-bottom: 24px;
5
+ ${(props: any) => props.isIos && css`
6
+ z-index: 20;
7
+ `}
8
+ `;
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { useLanguage } from 'ordering-components/native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { Container } from './styles';
5
+ import ODropDown from '../shared/ODropDown';
6
+ import { Platform } from 'react-native'
7
+
8
+ export const OrdersOptionDelivery = (props: any) => {
9
+ const {
10
+ search,
11
+ onSearch
12
+ } = props
13
+
14
+ const theme = useTheme();
15
+ const [, t] = useLanguage();
16
+ const optionsList: any = [
17
+ { value: '1', content: t('DELIVERY', 'Delivery') },
18
+ { value: '2', content: t('PICKUP', 'Pickup') }
19
+ ]
20
+
21
+ return (
22
+ <Container isIos={Platform.OS === 'ios'}>
23
+ <ODropDown
24
+ options={optionsList}
25
+ defaultValue={search.delivery_type}
26
+ onSelect={(option: any) => onSearch({ ...search, delivery_type: option })}
27
+ isModal
28
+ bgcolor={theme.colors.inputDisabled}
29
+ textcolor={theme.colors.unselectText}
30
+ placeholder={t('SELECT_DELIVERY_TYPE', 'Select Delivery type')}
31
+ dropViewMaxHeight={200}
32
+ />
33
+ </Container>
34
+ );
35
+ };
@@ -0,0 +1,8 @@
1
+ import styled, { css } from 'styled-components/native';
2
+
3
+ export const Container = styled.View`
4
+ margin-bottom: 24px;
5
+ ${(props: any) => props.isIos && css`
6
+ z-index: 16;
7
+ `}
8
+ `;
@@ -0,0 +1,50 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useLanguage, DriverList as DriverListControllder } from 'ordering-components/native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { Container } from './styles';
5
+ import ODropDown from '../shared/ODropDown';
6
+ import { Platform } from 'react-native'
7
+
8
+ export const OrdersOptionDriverUI = (props: any) => {
9
+ const {
10
+ search,
11
+ onSearch,
12
+ driverList
13
+ } = props
14
+
15
+ const theme = useTheme();
16
+ const [, t] = useLanguage();
17
+ const [optionsList, setOptionsList] = useState([])
18
+
19
+ useEffect(() => {
20
+ const drivers: any = []
21
+ for (const driver of driverList?.drivers) {
22
+ drivers.push({value: driver.id, content: driver.name})
23
+ }
24
+ setOptionsList(drivers)
25
+ }, [driverList?.drivers])
26
+
27
+ return (
28
+ <Container isIos={Platform.OS === 'ios'}>
29
+ <ODropDown
30
+ options={optionsList}
31
+ defaultValue={search.driver}
32
+ onSelect={(option: any) => onSearch({ ...search, driver: option })}
33
+ isModal
34
+ bgcolor={theme.colors.inputDisabled}
35
+ textcolor={theme.colors.unselectText}
36
+ placeholder={t('SELECT_DRIVER', 'Select Driver')}
37
+ dropViewMaxHeight={165}
38
+ />
39
+ </Container>
40
+ );
41
+ };
42
+
43
+ export const OrdersOptionDriver = (props: any) => {
44
+ const ordersOptionDriverProps = {
45
+ ...props,
46
+ propsToFetch: ['id', 'name', 'lastname'],
47
+ UIComponent: OrdersOptionDriverUI
48
+ };
49
+ return <DriverListControllder {...ordersOptionDriverProps} />;
50
+ };
@@ -0,0 +1,8 @@
1
+ import styled, { css } from 'styled-components/native';
2
+
3
+ export const Container = styled.View`
4
+ margin-bottom: 24px;
5
+ ${(props: any) => props.isIos && css`
6
+ z-index: 14;
7
+ `}
8
+ `;