ordering-ui-react-native 0.11.59 → 0.12.1

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.11.59",
3
+ "version": "0.12.1",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -34,7 +34,7 @@ import { UserFormDetailsUI } from './src/components/UserFormDetails';
34
34
  import { UserProfileForm } from './src/components/UserProfileForm';
35
35
  import { VerifyPhone } from './src/components/VerifyPhone';
36
36
  import { DriverMap } from './src/components/DriverMap';
37
-
37
+ import { MapViewUI as MapView } from './src/components/MapView'
38
38
  //OComponents
39
39
  import {
40
40
  OText,
@@ -74,6 +74,7 @@ export {
74
74
  LogoutButton,
75
75
  MessagesOption,
76
76
  NotFoundSource,
77
+ MapView,
77
78
  OrderDetailsBusiness,
78
79
  OrderDetailsDelivery,
79
80
  OrderMessage,
@@ -0,0 +1,286 @@
1
+ import React, { useState, useEffect, useRef, useCallback } from 'react';
2
+ import { Dimensions, SafeAreaView, StyleSheet, View } from 'react-native';
3
+ import { useFocusEffect } from '@react-navigation/native'
4
+ import MapView, {
5
+ PROVIDER_GOOGLE,
6
+ Marker,
7
+ Callout
8
+ } from 'react-native-maps';
9
+ import { useLanguage, useSession, MapView as MapViewController } from 'ordering-components/native';
10
+ import { MapViewParams } from '../../types';
11
+ import Alert from '../../providers/AlertProvider';
12
+ import { useTheme } from 'styled-components/native';
13
+ import { useLocation } from '../../hooks/useLocation';
14
+ import Icon from 'react-native-vector-icons/FontAwesome5';
15
+ import { OIcon, OText } from '../shared'
16
+
17
+ const MapViewComponent = (props: MapViewParams) => {
18
+
19
+ const {
20
+ onNavigationRedirect,
21
+ isLoadingBusinessMarkers,
22
+ getBusinessLocations,
23
+ markerGroups,
24
+ customerMarkerGroups
25
+ } = props;
26
+
27
+ const theme = useTheme();
28
+ const [, t] = useLanguage();
29
+ const [{ user }] = useSession()
30
+ const { width, height } = Dimensions.get('window');
31
+ const ASPECT_RATIO = width / height;
32
+ const mapRef = useRef<MapView>(null);
33
+ const following = useRef<boolean>(true);
34
+ const [isFocused, setIsFocused] = useState(false)
35
+ const [locationSelected, setLocationSelected] = useState<any>(null)
36
+ const [alertState, setAlertState] = useState<{
37
+ open: boolean;
38
+ content: Array<string>;
39
+ key?: string | null;
40
+ }>({ open: false, content: [], key: null });
41
+
42
+ const {
43
+ initialPosition,
44
+ userLocation,
45
+ stopFollowUserLocation,
46
+ followUserLocation
47
+ } = useLocation();
48
+
49
+ const location = { lat: userLocation.latitude, lng: userLocation.longitude }
50
+
51
+ const closeAlert = () => {
52
+ setAlertState({
53
+ open: false,
54
+ content: [],
55
+ });
56
+ };
57
+
58
+ const fitCoordinates = (location?: any) => {
59
+ if (mapRef.current) {
60
+ mapRef.current.fitToCoordinates(
61
+ [
62
+ { latitude: location.latitude, longitude: location.longitude },
63
+ {
64
+ latitude: userLocation.latitude,
65
+ longitude: userLocation.longitude,
66
+ },
67
+ ],
68
+ {
69
+ edgePadding: { top: 120, right: 120, bottom: 120, left: 120 },
70
+ },
71
+ );
72
+ }
73
+ };
74
+
75
+ useEffect(() => {
76
+ fitCoordinates(locationSelected || userLocation);
77
+ }, [userLocation, locationSelected]);
78
+
79
+
80
+ useEffect(() => {
81
+ if (isFocused) {
82
+ getBusinessLocations()
83
+ }
84
+ }, [isFocused])
85
+
86
+ useEffect(() => {
87
+ followUserLocation();
88
+
89
+ return () => {
90
+ stopFollowUserLocation();
91
+ };
92
+ }, []);
93
+
94
+
95
+ useFocusEffect(
96
+ useCallback(() => {
97
+ setIsFocused(true)
98
+ return () => {
99
+ stopFollowUserLocation()
100
+ setIsFocused(false)
101
+ setLocationSelected(null)
102
+ }
103
+ }, [])
104
+ )
105
+
106
+ const styles = StyleSheet.create({
107
+ image: {
108
+ borderRadius: 50,
109
+ },
110
+ view: {
111
+ width: 25,
112
+ position: 'absolute',
113
+ top: 6,
114
+ left: 6,
115
+ bottom: 0,
116
+ right: 0,
117
+ },
118
+ });
119
+
120
+ const RenderMarker = ({ marker, customer, orderIds }: { marker: any, customer?: boolean, orderIds?: Array<number> }) => {
121
+ const markerRef = useRef<any>()
122
+ useEffect(() => {
123
+ if (
124
+ markerRef?.current?.props?.coordinate?.latitude === locationSelected?.latitude &&
125
+ markerRef?.current?.props?.coordinate?.longitude === locationSelected?.longitude
126
+ ) {
127
+ markerRef?.current?.showCallout()
128
+ } else {
129
+ markerRef?.current?.hideCallout()
130
+ }
131
+ }, [locationSelected])
132
+
133
+ return (
134
+ <Marker
135
+ key={customer ? marker?.customer?.id : marker?.business?.id}
136
+ coordinate={{
137
+ latitude: customer ? marker?.customer?.location?.lat : marker?.business?.location?.lat,
138
+ longitude: customer ? marker?.customer?.location?.lng : marker?.business?.location?.lng
139
+ }}
140
+ onPress={() =>
141
+ setLocationSelected({
142
+ latitude: customer ? marker?.customer?.location?.lat : marker?.business?.location?.lat,
143
+ longitude: customer ? marker?.customer?.location?.lng : marker?.business?.location?.lng
144
+ })
145
+ }
146
+ ref={(ref) => markerRef.current = ref}
147
+ >
148
+ <Icon
149
+ name="map-marker"
150
+ size={50}
151
+ color={theme.colors.primary}
152
+ />
153
+ <View style={styles.view}>
154
+ <OIcon
155
+ style={styles.image}
156
+ src={{ uri: customer ? marker?.customer?.photo : marker?.business?.logo }}
157
+ width={25}
158
+ height={25}
159
+ />
160
+ </View>
161
+ <Callout
162
+ onPress={() => !!orderIds && orderIds.toString().includes(',') ? onNavigationRedirect('Orders') : onNavigationRedirect('OrderDetails', { order: marker })}
163
+ >
164
+ <View style={{ flex: 1, width: 200, padding: 5 }}>
165
+ <OText weight='bold'>{customer ? `${marker?.customer?.name} ${marker?.customer?.lastname}` : marker?.business?.name}</OText>
166
+ <OText>
167
+ {!!orderIds && orderIds.toString().includes(',') ? (
168
+ <>
169
+ {t('ORDER_NUMBERS', 'Order Numbers')} {orderIds}
170
+ </>
171
+ ) : (
172
+ <>
173
+ {t('ORDER_NUMBER', 'Order No.')} {marker?.id}
174
+ </>
175
+ )}
176
+ </OText>
177
+ <OText>{customer ? marker?.customer?.address : marker?.business?.address}</OText>
178
+ {((customer && marker?.customer?.city?.address_notes) || !customer) && (
179
+ <OText>{customer ? marker?.customer?.city?.address_notes : marker?.business?.city?.name}</OText>
180
+ )}
181
+ {((customer && marker?.business?.zipcode) || (!customer && marker?.business?.zipcode)) && (
182
+ <OText>{customer ? marker?.customer?.zipcode : marker?.business?.zipcode}</OText>
183
+ )}
184
+ {customer && marker?.customer?.internal_number && (
185
+ <OText>{marker?.customer?.internal_number}</OText>
186
+ )}
187
+ <OText textDecorationLine='underline' color={theme.colors.primary}>
188
+ {!!orderIds && orderIds.toString().includes(',') ? (
189
+ <>
190
+ {t('SHOW_ORDERS', 'Show orders')}
191
+ </>
192
+ ) : (
193
+ <>
194
+ {t('MORE_INFO', 'More info')}
195
+ </>
196
+ )}
197
+ </OText>
198
+ </View>
199
+ </Callout>
200
+ </Marker>
201
+ )
202
+ }
203
+ return (
204
+ <SafeAreaView style={{ flex: 1 }}>
205
+ <View style={{ flex: 1 }}>
206
+ <View style={{ flex: 1 }}>
207
+ {typeof initialPosition?.latitude === 'number' && !isLoadingBusinessMarkers && isFocused && (
208
+ <MapView
209
+ ref={mapRef}
210
+ provider={PROVIDER_GOOGLE}
211
+ initialRegion={{
212
+ latitude: initialPosition.latitude,
213
+ longitude: initialPosition.longitude,
214
+ latitudeDelta: 0.01,
215
+ longitudeDelta: 0.01 * ASPECT_RATIO,
216
+ }}
217
+ style={{ flex: 1 }}
218
+ zoomTapEnabled
219
+ zoomEnabled
220
+ zoomControlEnabled
221
+ cacheEnabled
222
+ moveOnMarkerPress
223
+ onTouchStart={() => (following.current = false)}
224
+ >
225
+ <>
226
+ {Object.values(markerGroups).map((marker: any) => (
227
+ <RenderMarker
228
+ key={marker[0]?.business_id}
229
+ marker={marker[0]}
230
+ orderIds={marker.map((order: any) => order.id).join(', ')}
231
+ />
232
+ ))}
233
+ {Object.values(customerMarkerGroups).map((marker: any) => (
234
+ <RenderMarker
235
+ key={marker[0]?.customer_id}
236
+ marker={marker[0]}
237
+ orderIds={marker.map((order: any) => order.id).join(', ')}
238
+ customer
239
+ />
240
+ ))}
241
+ <Marker
242
+ coordinate={{
243
+ latitude: location.lat,
244
+ longitude: location.lng,
245
+ }}
246
+ title={t('YOUR_LOCATION', 'Your Location')}
247
+ >
248
+ <Icon
249
+ name="map-marker"
250
+ size={50}
251
+ color={theme.colors.primary}
252
+ />
253
+ <View style={styles.view}>
254
+ <OIcon
255
+ style={styles.image}
256
+ src={{ uri: user.photo }}
257
+ width={25}
258
+ height={25}
259
+ />
260
+ </View>
261
+ </Marker>
262
+ </>
263
+ </MapView>
264
+ )}
265
+ </View>
266
+ </View>
267
+ <View>
268
+ <Alert
269
+ open={alertState.open}
270
+ onAccept={closeAlert}
271
+ onClose={closeAlert}
272
+ content={alertState.content}
273
+ title={t('ERROR', 'Error')}
274
+ />
275
+ </View>
276
+ </SafeAreaView >
277
+ );
278
+ };
279
+
280
+ export const MapViewUI = (props: any) => {
281
+ const MapViewProps = {
282
+ ...props,
283
+ UIComponent: MapViewComponent
284
+ }
285
+ return <MapViewController {...MapViewProps} />
286
+ }
@@ -23,6 +23,7 @@ const SText = styled.Text`
23
23
  css`
24
24
  flex: ${props.weight ? 1 : 0};
25
25
  `};
26
+ text-decoration: ${(props : any) => props.textDecorationLine};
26
27
  `;
27
28
  interface Props {
28
29
  color?: string;
@@ -39,6 +40,7 @@ interface Props {
39
40
  numberOfLines?: number;
40
41
  ellipsizeMode?: string;
41
42
  adjustsFontSizeToFit?: boolean;
43
+ textDecorationLine?: string
42
44
  }
43
45
 
44
46
  const OText = (props: Props): React.ReactElement => {
@@ -539,3 +539,11 @@ export interface AcceptOrRejectOrderParams {
539
539
  titleReject?: textTranslate;
540
540
  appTitle?: textTranslate;
541
541
  }
542
+
543
+ export interface MapViewParams {
544
+ onNavigationRedirect: (page : string, params ?: any) => void,
545
+ getBusinessLocations: () => void,
546
+ isLoadingBusinessMarkers?: boolean,
547
+ markerGroups: Array<any>,
548
+ customerMarkerGroups: Array<any>
549
+ }
@@ -34,7 +34,7 @@ const CustomerName = (props: Props): React.ReactElement => {
34
34
  marginBottom: 20,
35
35
  borderWidth: 1,
36
36
  borderColor: theme.colors.disabled,
37
- height: 44
37
+ height: 50
38
38
  },
39
39
  });
40
40
 
@@ -67,72 +67,99 @@ const CustomerName = (props: Props): React.ReactElement => {
67
67
  }}
68
68
  />);
69
69
 
70
+ const skipButton = (
71
+ <View style={{flex:1, left: orientationState?.dimensions.width * 0.2,}}>
72
+ <OButton
73
+ text={t('SKIP', 'Skip')}
74
+ onClick={onProceedToPay}
75
+ textStyle={{color: theme.colors.primaryContrast, fontSize: 20}}
76
+ parentStyle={{
77
+ height: orientationState?.orientation === PORTRAIT
78
+ ? 50 : 100
79
+ }}
80
+ style={{
81
+ width: orientationState?.orientation === PORTRAIT
82
+ ? orientationState?.dimensions.width - 40
83
+ : orientationState?.dimensions.width * 0.1,
84
+ }}
85
+ />
86
+ </View>
87
+ );
88
+
70
89
  return (
71
90
  <>
72
- <Container>
73
- <NavBar
74
- title={t('YOUR_NAME', 'Your name')}
75
- onActionLeft={goToBack}
76
- btnStyle={{paddingLeft: 0}}
77
- />
78
-
79
- <View style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
80
- <OText
81
- size={orientationState?.dimensions?.width * 0.05}
82
- >
83
- {t('WHOM_MIGHT_THIS', 'Whom might this')} {'\n'}
84
- <OText
85
- size={orientationState?.dimensions?.width * 0.05}
86
- weight={'700'}
87
- >
88
- {`${t('ORDER_BE_FOR', 'order be for?')}`}
89
- </OText>
90
- </OText>
91
- </View>
92
-
93
- <Controller
94
- control={control}
95
- render={({ onChange, value }: any) => (
96
- <OInput
97
- placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
98
- style={{
99
- ...styles.inputStyle,
100
- width: orientationState?.orientation === PORTRAIT
101
- ? orientationState?.dimensions.width - 40
102
- : orientationState?.dimensions.width * 0.5,
103
- }}
104
- value={value}
105
- autoCapitalize="words"
106
- autoCorrect={false}
107
- onChange={(val: any) => onChange(val)}
108
- />
109
- )}
110
- name="name"
111
- rules={{
112
- required: t(
113
- 'VALIDATION_ERROR_REQUIRED',
114
- 'The field Customer Name is required',
115
- ).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
116
- pattern: {
117
- value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
118
- message: t(
119
- 'INVALID_ERROR',
120
- 'Invalid name',
121
- ).replace('_attribute_', t('NAME', 'Name')),
122
- }
123
- }}
124
- defaultValue=""
125
- />
126
-
127
- {orientationState?.orientation === LANDSCAPE && submitButton}
128
- </Container>
91
+ <Container>
92
+ <NavBar
93
+ title={t('YOUR_NAME', 'Your name')}
94
+ onActionLeft={goToBack}
95
+ btnStyle={{paddingLeft: 0}}
96
+ />
97
+ <View style={{
98
+ marginVertical: orientationState?.dimensions?.height * 0.08,
99
+ paddingLeft: orientationState?.dimensions?.width * 0.25
100
+ }}>
101
+ <OText
102
+ size={orientationState?.dimensions?.width * 0.05}
103
+ style={{bottom: 20}}
104
+ >
105
+ {t('WHATS_YOUR_NAME', "What's your name?")}
106
+ {/* <OText
107
+ size={orientationState?.dimensions?.width * 0.05}
108
+ weight={'700'}
109
+ >
110
+ {`${t('ORDER_BE_FOR', 'order be for?')}`}
111
+ </OText> */}
112
+ </OText>
113
+ <Controller
114
+ control={control}
115
+ render={({ onChange, value }: any) => (
116
+ <OInput
117
+ placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
118
+ style={{
119
+ ...styles.inputStyle,
120
+ width: orientationState?.orientation === PORTRAIT
121
+ ? orientationState?.dimensions.width - 40
122
+ : orientationState?.dimensions.width * 0.5,
123
+ }}
124
+ value={value}
125
+ autoCapitalize="words"
126
+ autoCorrect={false}
127
+ onChange={(val: any) => onChange(val)}
128
+ onSubmitEditing={handleSubmit(onSubmit)}
129
+ />
130
+ )}
131
+ name="name"
132
+ rules={{
133
+ required: t(
134
+ 'VALIDATION_ERROR_REQUIRED',
135
+ 'The field Customer Name is required',
136
+ ).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
137
+ pattern: {
138
+ value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
139
+ message: t(
140
+ 'INVALID_ERROR',
141
+ 'Invalid name',
142
+ ).replace('_attribute_', t('NAME', 'Name')),
143
+ }
144
+ }}
145
+ defaultValue=""
146
+ />
129
147
 
130
- {(orientationState?.orientation === PORTRAIT) && (
131
- <OSActions>
132
- {submitButton}
133
- </OSActions>
134
- )}
135
- </>
148
+ {orientationState?.orientation === LANDSCAPE && submitButton}
149
+ {orientationState?.orientation === LANDSCAPE && skipButton}
150
+ {(orientationState?.orientation === PORTRAIT) && (
151
+ <OSActions>
152
+ {submitButton}
153
+ </OSActions>
154
+ )}
155
+ {(orientationState?.orientation === PORTRAIT) && (
156
+ <OSActions>
157
+ {skipButton}
158
+ </OSActions>
159
+ )}
160
+ </View>
161
+ </Container>
162
+ </>
136
163
  );
137
164
  };
138
165
 
@@ -27,7 +27,7 @@ import {
27
27
  import { OrderDetailsParams, Product } from '../../types'
28
28
  import { Container } from '../../layouts/Container';
29
29
  import NavBar from '../../components/NavBar';
30
- import { OButton, OImage, OInput, OText } from '../../components/shared';
30
+ import { OButton, OIconButton, OImage, OInput, OText } from '../../components/shared';
31
31
  import GridContainer from '../../layouts/GridContainer';
32
32
  import OptionSwitch, { Opt } from '../../components/shared/OOptionToggle';
33
33
  import { verifyDecimals } from '../../../../../src/utils'
@@ -35,6 +35,7 @@ import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/ho
35
35
  import { useTheme } from 'styled-components/native'
36
36
  import { _retrieveStoreData } from '../../../../../src/providers/StoreUtil';
37
37
  import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
38
+ import EvilIcons from 'react-native-vector-icons/EvilIcons'
38
39
  const _EMAIL = 'email';
39
40
  const _SMS = 'sms';
40
41
 
@@ -335,7 +336,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
335
336
  </OSInputWrapper>
336
337
 
337
338
  <OButton
338
- text={`${t('YOU_ARE_DONE', 'You are done')}!`}
339
+ text={`${t('YOU_ARE_DONE', 'You are done! Click to close')}!`}
339
340
  onClick={() => {
340
341
  navigation.reset({
341
342
  routes: [{ name: 'Intro' }],
@@ -493,18 +494,46 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
493
494
  <>
494
495
  <Container>
495
496
  <NavBar
496
- title={t('TAKE_YOUR_RECEIPT', 'Take your receipt')}
497
+ title={t('BACK_BUTTON_CONFIRMATION', 'Confirmation')}
497
498
  style={{ right: 10 }}
499
+ rightComponent={
500
+ <OIconButton
501
+ bgColor="transparent"
502
+ borderColor="transparent"
503
+ RenderIcon={() =>
504
+ <EvilIcons
505
+ name={'close'}
506
+ size={40}
507
+ color={theme.colors.primary}
508
+ />
509
+ }
510
+ style={{ flex:1, justifyContent: 'flex-end', left: 30 }}
511
+ onClick={() => {
512
+ navigation.reset({
513
+ routes: [{ name: 'Intro' }],
514
+ });
515
+ }}
516
+ />
517
+ }
498
518
  />
499
519
 
500
520
  <View style={{
501
521
  marginVertical: orientationState?.dimensions?.height * 0.03,
502
522
  flexDirection: orientationState?.orientation === PORTRAIT ? 'column' : 'row',
503
523
  }}>
524
+ <View
525
+ style={{
526
+ flex: 1,
527
+ marginVertical: orientationState?.orientation === PORTRAIT ? 40 : 0,
528
+ }}
529
+ >
530
+ {orderDetailsContent}
531
+ </View>
504
532
  <View style={{
505
- flex: 1,
533
+ flex: 1.1,
506
534
  marginRight: orientationState?.orientation === PORTRAIT ? 0 : 20,
507
- justifyContent: 'space-between'
535
+ justifyContent: 'space-between',
536
+ marginLeft: 20
508
537
  }}>
509
538
  <View>
510
539
  <OText
@@ -523,22 +552,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
523
552
  <OText
524
553
  size={orientationState?.dimensions?.width * (orientationState?.orientation === PORTRAIT ? 0.04 : 0.025)}
525
554
  >
526
- {t('TO_FINISH_TAKE_YOUR_RECEIPT_AND_GO_TO_THE_FRONT_COUNTER', 'To finish take your receipt and go to the front counter.')}
555
+ {t('TO_FINISH_TAKE_YOUR_RECEIPT_AND_GO_TO_THE_FRONT_COUNTER', "We`ve received your order and we will call you by your name or your order number.")}
527
556
  </OText>
528
557
 
529
558
  </View>
530
559
 
531
560
  {orientationState?.orientation === LANDSCAPE && actionsContent}
532
561
  </View>
533
-
534
- <View
535
- style={{
536
- flex: 1.4,
537
- marginVertical: orientationState?.orientation === PORTRAIT ? 40 : 0,
538
- }}
539
- >
540
- {orderDetailsContent}
541
- </View>
542
562
  </View>
543
563
  </Container>
544
564
 
@@ -1,31 +1,76 @@
1
- import { AddressForm } from './src/components/AddressForm';
2
- import { AddressDetails } from './src/components/AddressDetails';
3
- import { Home } from './src/components/Home';
4
- import { LoginForm } from './src/components/LoginForm';
5
- import { SignupForm } from './src/components/SignupForm';
6
1
  import { ActiveOrders } from './src/components/ActiveOrders';
2
+ import { AddressDetails } from './src/components/AddressDetails';
3
+ import { AddressForm } from './src/components/AddressForm';
7
4
  import { AddressList } from './src/components/AddressList';
8
5
  import { AppleLogin } from './src/components/AppleLogin';
6
+ import BottomWrapper from './src/components/BottomWrapper';
7
+ import { BusinessBasicInformation } from './src/components/BusinessBasicInformation';
8
+ import { BusinessController } from './src/components/BusinessController';
9
9
  import { BusinessesListing } from './src/components/BusinessesListing';
10
+ import { BusinessFeaturedController } from './src/components/BusinessFeaturedController';
11
+ import { BusinessInformation } from './src/components/BusinessInformation';
12
+ import { BusinessItemAccordion } from './src/components/BusinessItemAccordion';
13
+ import { BusinessProductsCategories } from './src/components/BusinessProductsCategories';
14
+ import { BusinessProductsList } from './src/components/BusinessProductsList';
10
15
  import { BusinessProductsListing } from './src/components/BusinessProductsListing';
16
+ import { BusinessReviews } from './src/components/BusinessReviews';
17
+ import { BusinessTypeFilter } from './src/components/BusinessTypeFilter';
18
+ import { Cart } from './src/components/Cart';
11
19
  import { CartContent } from './src/components/CartContent';
12
20
  import { Checkout } from './src/components/Checkout';
21
+ import { CouponControl } from './src/components/CouponControl';
22
+ import { DriverTips } from './src/components/DriverTips';
23
+ import { FacebookLogin } from './src/components/FacebookLogin';
24
+ import { FloatingButton } from './src/components/FloatingButton';
13
25
  import { ForgotPasswordForm } from './src/components/ForgotPasswordForm';
26
+ import { GoogleLogin } from './src/components/GoogleLogin';
27
+ import { GoogleMap } from './src/components/GoogleMap';
28
+ import { GPSButton } from './src/components/GPSButton';
29
+ import { Help } from './src/components/Help';
30
+ import { HelpAccountAndPayment } from './src/components/HelpAccountAndPayment';
31
+ import { HelpGuide } from './src/components/HelpGuide';
32
+ import { HelpOrder } from './src/components/HelpOrder';
33
+ import { Home } from './src/components/Home';
34
+ import { LanguageSelector } from './src/components/LanguageSelector';
35
+ import { LastOrder } from './src/components/LastOrder';
36
+ import { LastOrders } from './src/components/LastOrders';
37
+ import { LoginForm } from './src/components/LoginForm';
38
+ import { LogoutButton } from './src/components/LogoutButton';
39
+ import { Messages } from './src/components/Messages';
14
40
  import { MomentOption } from './src/components/MomentOption';
15
- import { OrdersOption } from './src/components/OrdersOption';
41
+ import NavBar from './src/components/NavBar';
42
+ import { NotFoundSource } from './src/components/NotFoundSource';
43
+ import Notifications from './src/components/Notifications';
16
44
  import { OrderDetails } from './src/components/OrderDetails';
17
- import { UserProfileForm } from './src/components/UserProfileForm';
45
+ import { OrdersOption } from './src/components/OrdersOption';
46
+ import { OrderSummary } from './src/components/OrderSummary';
47
+ import { OrderTypeSelector } from './src/components/OrderTypeSelector';
48
+ import { PaymentOptionCash } from './src/components/PaymentOptionCash';
49
+ import { PaymentOptions } from './src/components/PaymentOptions';
50
+ import { PaymentOptionStripe } from './src/components/PaymentOptionStripe';
51
+ import { PhoneInputNumber } from './src/components/PhoneInputNumber';
52
+ import { PreviousOrders } from './src/components/PreviousOrders';
53
+ import { ProductForm } from './src/components/ProductForm';
54
+ import { ProductIngredient } from './src/components/ProductIngredient';
55
+ import { ProductItemAccordion } from './src/components/ProductItemAccordion';
56
+ import { ProductOption } from './src/components/ProductOption';
57
+ import { ProductOptionSubOption } from './src/components/ProductOptionSubOption';
18
58
  import { ReviewOrder } from './src/components/ReviewOrder';
59
+ import { SearchBar } from './src/components/SearchBar';
60
+ import { SignupForm } from './src/components/SignupForm';
61
+ import { SingleProductCard } from './src/components/SingleProductCard';
62
+ import { StripeCardForm } from './src/components/StripeCardForm';
63
+ import { StripeCardsList } from './src/components/StripeCardsList';
64
+ import { StripeElementsForm } from './src/components/StripeElementsForm';
65
+ import { StripeRedirectForm } from './src/components/StripeRedirectForm';
66
+ import TagSelector from './src/components/TagSelector';
67
+ import { UpsellingProducts } from './src/components/UpsellingProducts';
68
+ import { UserDetails } from './src/components/UserDetails';
69
+ import { UserFormDetailsUI } from './src/components/UserFormDetails';
19
70
  import { UserProfile } from './src/components/UserProfile';
20
- import { NotFoundSource } from './src/components/NotFoundSource';
21
- import { Help } from './src/components/Help';
22
- import { HelpOrder } from './src/components/HelpOrder';
23
- import { HelpGuide } from './src/components/HelpGuide';
24
- import { HelpAccountAndPayment } from './src/components/HelpAccountAndPayment';
25
- import { OrderTypeSelector } from './src/components/OrderTypeSelector';
26
- import Notifications from './src/components/Notifications';
71
+ import { UserProfileForm } from './src/components/UserProfileForm';
72
+ import { VerifyPhone } from './src/components/VerifyPhone';
27
73
 
28
- import { Toast } from './src/components/shared/OToast';
29
74
  import {
30
75
  OText,
31
76
  OButton,
@@ -40,6 +85,7 @@ import {
40
85
  OAlert,
41
86
  OModal,
42
87
  OBottomPopup,
88
+ Toast
43
89
  } from './src/components/shared';
44
90
 
45
91
  import { Container } from './src/layouts/Container';
@@ -78,6 +124,52 @@ export {
78
124
  HelpAccountAndPayment,
79
125
  OrderTypeSelector,
80
126
  Notifications,
127
+ BottomWrapper,
128
+ BusinessBasicInformation,
129
+ BusinessController,
130
+ BusinessFeaturedController,
131
+ BusinessInformation,
132
+ BusinessItemAccordion,
133
+ BusinessProductsCategories,
134
+ BusinessProductsList,
135
+ BusinessReviews,
136
+ BusinessTypeFilter,
137
+ Cart,
138
+ CouponControl,
139
+ DriverTips,
140
+ FacebookLogin,
141
+ FloatingButton,
142
+ GoogleLogin,
143
+ GoogleMap,
144
+ GPSButton,
145
+ LanguageSelector,
146
+ LastOrder,
147
+ LastOrders,
148
+ LogoutButton,
149
+ Messages,
150
+ NavBar,
151
+ OrderSummary,
152
+ PaymentOptionCash,
153
+ PaymentOptions,
154
+ PaymentOptionStripe,
155
+ PhoneInputNumber,
156
+ PreviousOrders,
157
+ ProductForm,
158
+ ProductIngredient,
159
+ ProductItemAccordion,
160
+ ProductOption,
161
+ ProductOptionSubOption,
162
+ SearchBar,
163
+ SingleProductCard,
164
+ StripeCardForm,
165
+ StripeCardsList,
166
+ StripeElementsForm,
167
+ StripeRedirectForm,
168
+ TagSelector,
169
+ UpsellingProducts,
170
+ UserDetails,
171
+ UserFormDetailsUI,
172
+ VerifyPhone,
81
173
 
82
174
  // OComponents
83
175
  Toast,
@@ -104,4 +196,4 @@ export {
104
196
  _setStoreData,
105
197
  _removeStoreData,
106
198
  _clearStoreData
107
- }
199
+ }
@@ -55,6 +55,11 @@ export const BusinessBasicInformation = (
55
55
  return _types.join(', ');
56
56
  };
57
57
 
58
+ const onNavigationRedirect = (page: string, params: any) => {
59
+ if (!page) return
60
+ navigation.navigate(page, params);
61
+ }
62
+
58
63
  return (
59
64
  <BusinessContainer>
60
65
  <BusinessHeader
@@ -150,7 +155,12 @@ export const BusinessBasicInformation = (
150
155
  {business?.name}
151
156
  </OText>
152
157
  {!isBusinessInfoShow && (
153
- <WrapBusinessInfo onPress={() => setOpenBusinessInformation(true)}>
158
+ <WrapBusinessInfo
159
+ onPress={() => onNavigationRedirect(
160
+ 'BusinessInformation',
161
+ { businessState, business }
162
+ )}
163
+ >
154
164
  <OIcon src={theme.images.general.info} width={16} color={theme.colors.textSecondary} />
155
165
  </WrapBusinessInfo>
156
166
  )}
@@ -227,7 +237,7 @@ export const BusinessBasicInformation = (
227
237
  )}
228
238
  </WrapReviews>
229
239
  </BusinessInfo>
230
- <OModal
240
+ {/* <OModal
231
241
  titleSectionStyle={styles.modalTitleSectionStyle}
232
242
  open={openBusinessInformation}
233
243
  onClose={() => setOpenBusinessInformation(false)}
@@ -236,7 +246,7 @@ export const BusinessBasicInformation = (
236
246
  businessState={businessState}
237
247
  business={business}
238
248
  />
239
- </OModal>
249
+ </OModal> */}
240
250
  <OModal
241
251
  entireModal
242
252
  titleSectionStyle={styles.modalTitleSectionStyle}
@@ -62,4 +62,4 @@ export const DropOptionButton = styled.TouchableOpacity`
62
62
  padding-horizontal: 8px;
63
63
  flex-direction: row;
64
64
  margin-end: 12px;
65
- `
65
+ `
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import {
3
3
  BusinessInformation as BusinessInformationController,
4
4
  useLanguage, useUtils
5
5
  } from 'ordering-components/native';
6
6
  import { useTheme } from 'styled-components/native';
7
- import { OIcon, OText } from '../shared';
7
+ import { SliderBox } from 'react-native-image-slider-box';
8
+ import { OIcon, OText, OModal } from '../shared';
8
9
  import {
9
10
  BusinessInformationContainer,
10
11
  WrapMainContent,
@@ -16,17 +17,21 @@ import {
16
17
  DivideView,
17
18
  MediaWrapper,
18
19
  } from './styles';
19
- import { Platform, StyleSheet, View } from 'react-native';
20
+ import { Platform, StyleSheet, TouchableOpacity, View } from 'react-native';
20
21
  import { BusinessInformationParams } from '../../types';
21
22
  import { GoogleMap } from '../GoogleMap';
22
23
  import { WebView } from 'react-native-webview';
24
+ import NavBar from '../../../../../src/components/NavBar'
23
25
 
24
26
  const BusinessInformationUI = (props: BusinessInformationParams) => {
25
- const { businessState, businessSchedule, businessLocation } = props;
27
+ const { businessState, business, businessSchedule, businessLocation } = props;
26
28
 
27
29
  const theme = useTheme();
28
30
  const [, t] = useLanguage();
29
31
  const [{ optimizeImage }] = useUtils();
32
+
33
+ const [openImages, setOpenImages] = useState(false)
34
+
30
35
  const daysOfWeek = [
31
36
  t('SUNDAY_ABBREVIATION', 'Sun'),
32
37
  t('MONDAY_ABBREVIATION', 'Mon'),
@@ -69,7 +74,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
69
74
  return vAry;
70
75
  };
71
76
  const bImages: any = () => {
72
- const len = businessState?.business?.gallery?.length | 0;
77
+ const len = businessState?.business?.gallery?.length ?? 0;
73
78
  if (len == 0) return [];
74
79
  const iAry = businessState?.business?.gallery.filter(
75
80
  ({ type, video }: any) => type == 1 && video == null,
@@ -79,6 +84,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
79
84
 
80
85
  return (
81
86
  <BusinessInformationContainer>
87
+ <NavBar
88
+ style={{ paddingBottom: 0 }}
89
+ onActionLeft={() => props.navigation?.canGoBack() && props.navigation.goBack()}
90
+ />
82
91
  <WrapMainContent contentContainerStyle={{}}>
83
92
  <InnerContent>
84
93
  <OText size={24} weight={Platform.OS === 'ios' ? '600' : 'bold'}>
@@ -89,7 +98,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
89
98
  {t('BUSINESS_LOCATION', 'Business Location')}
90
99
  </OText>
91
100
  </GrayBackground>
92
- {businessLocation.location && (
101
+ {!!businessLocation.location && (
93
102
  <WrapBusinessMap style={styles.wrapMapStyle}>
94
103
  <GoogleMap
95
104
  readOnly
@@ -107,7 +116,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
107
116
  {t('OPENING_TIME', 'Opening Time')}
108
117
  </OText>
109
118
  </GrayBackground>
110
- {businessSchedule && businessSchedule?.length > 0 && (
119
+ {!!businessSchedule && businessSchedule?.length > 0 && (
111
120
  <WrapScheduleBlock>
112
121
  {businessSchedule.map((schedule: any, i: number) => (
113
122
  <ScheduleBlock key={i}>
@@ -164,19 +173,41 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
164
173
  {t('IMAGES', 'Images')}
165
174
  </OText>
166
175
  </GrayBackground>
176
+
167
177
  <MediaWrapper horizontal>
168
- {bImages().map((i: any) => (
169
- i.file != null &&
170
- <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
171
- <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
172
- </View>
173
- ))}
178
+ {bImages().map((i: any) => ( i.file != null && (
179
+ <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
180
+ <TouchableOpacity onPress={() => setOpenImages(true)}>
181
+ <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
182
+ </TouchableOpacity>
183
+ </View>
184
+ )))}
174
185
  </MediaWrapper>
175
186
  </>
176
187
  )}
177
188
  </>
178
189
  </InnerContent>
179
190
  </WrapMainContent>
191
+ <OModal
192
+ titleSectionStyle={styles.modalTitleSectionStyle}
193
+ open={openImages}
194
+ onClose={() => setOpenImages(false)}
195
+ isNotDecoration
196
+ >
197
+ <View style={{ height: '100%', flexDirection: 'row', justifyContent: 'center', alignItems: 'center'}}>
198
+ <View style={{ marginTop: 20, height: 200}}>
199
+ <SliderBox
200
+ // circleLoop
201
+ sliderBoxHeight={200}
202
+ images={bImages().map((image: any) => optimizeImage(image?.file, 'h_300,c_limit'))}
203
+ dotColor={theme.colors.primary}
204
+ inactiveDotColor={theme.colors.backgroundGray}
205
+ dotStyle={styles.dotStyle}
206
+ activeOpacity={1}
207
+ />
208
+ </View>
209
+ </View>
210
+ </OModal>
180
211
  </BusinessInformationContainer>
181
212
  );
182
213
  };
@@ -187,6 +218,21 @@ const styles = StyleSheet.create({
187
218
  marginTop: 15,
188
219
  marginBottom: 10,
189
220
  },
221
+ dotStyle: {
222
+ width: 15,
223
+ height: 15,
224
+ borderRadius: 15,
225
+ marginHorizontal: 10,
226
+ padding: 0,
227
+ margin: 0
228
+ },
229
+ modalTitleSectionStyle: {
230
+ position: 'absolute',
231
+ width: '100%',
232
+ top: 0,
233
+ zIndex: 100,
234
+ left: 40
235
+ },
190
236
  });
191
237
 
192
238
  export const BusinessInformation = (props: BusinessInformationParams) => {
@@ -8,7 +8,7 @@ export const GrayBackground = styled.View`
8
8
  margin-top: 27px;
9
9
  `
10
10
  export const WrapMainContent = styled.ScrollView`
11
- margin-top: 40px;
11
+ /* margin-top: 40px; */
12
12
  `
13
13
  export const MediaWrapper = styled.ScrollView`
14
14
  margin-top: 16px;
@@ -36,4 +36,4 @@ export const DivideView = styled.View`
36
36
  height: 8px;
37
37
  background-color: ${(props: any) => props.theme.colors.backgroundGray100};
38
38
  margin-horizontal: -40px;
39
- `;
39
+ `;
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
3
  import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
-
4
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
5
  import {
6
6
  Checkout as CheckoutController,
7
7
  useOrder,
@@ -22,6 +22,10 @@ import { PaymentOptions } from '../PaymentOptions';
22
22
  import { DriverTips } from '../DriverTips';
23
23
  import { NotFoundSource } from '../NotFoundSource';
24
24
  import { UserDetails } from '../UserDetails';
25
+ import { FloatingButton } from '../FloatingButton';
26
+ import { Container } from '../../layouts/Container';
27
+ import NavBar from '../NavBar';
28
+ import { OrderSummary } from '../OrderSummary';
25
29
 
26
30
  import {
27
31
  ChContainer,
@@ -36,12 +40,7 @@ import {
36
40
  ChUserDetails,
37
41
  ChCart
38
42
  } from './styles';
39
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
40
43
 
41
- import { FloatingButton } from '../FloatingButton';
42
- import { Container } from '../../layouts/Container';
43
- import NavBar from '../NavBar';
44
- import { OrderSummary } from '../OrderSummary';
45
44
  import { getTypesText } from '../../utils';
46
45
 
47
46
  const mapConfigs = {
@@ -84,6 +84,7 @@ const DriverTipsUI = (props: any) => {
84
84
  <TouchableOpacity
85
85
  key={i}
86
86
  onPress={() => handleChangeOpt(option)}
87
+ disabled={loading}
87
88
  >
88
89
  <DTCard
89
90
  style={style.circle}
@@ -13,21 +13,22 @@ export const DTWrapperTips = styled.View`
13
13
  display: flex;
14
14
  flex-direction: row;
15
15
  width: 100%;
16
- justify-content: space-between;
16
+ justify-content: space-evenly;
17
17
  align-items: center;
18
18
  flex-wrap: wrap;
19
19
  `
20
20
 
21
21
  export const DTCard = styled.View`
22
+ display: flex;
22
23
  justify-content: center;
23
24
  align-items: center;
24
- padding: 10px;
25
- border: 1px solid ${(props: any) => props.isActive ? props.theme.colors.primary : props.theme.colors.border};
25
+ padding: 15px;
26
+ border: 1px solid ${(props: any) => props.theme.colors.whiteGray};
26
27
  text-transform: capitalize;
27
- min-height: 48px;
28
- min-width: 48px;
29
- width: 48px;
30
- height: 48px;
28
+ min-height: 60px;
29
+ min-width: 60px;
30
+ margin-right: 10px;
31
+ margin-top: 10px;
31
32
 
32
33
  ${(props: any) => props.isActive && css`
33
34
  background-color: ${(props: any) => props.theme.colors.primary};
@@ -45,11 +46,11 @@ export const DTForm = styled.View`
45
46
  export const DTLabel = styled.Text`
46
47
  font-size: 10px;
47
48
  align-self: flex-start;
48
- color: ${(props: any) => props.theme.colors.textSecondary}
49
+ color: ${(props: any) => props.theme.colors.textSecondary};
49
50
  ${(props: any) => props.theme?.rtl && css`
50
51
  margin-left: 20px;
51
52
  margin-right: 0;
52
- `}
53
+ `};
53
54
  margin-top: 5px;
54
55
  margin-bottom: 17px;
55
56
  `
@@ -134,7 +134,7 @@ const PaymentOptionsUI = (props: any) => {
134
134
  />
135
135
  <OText
136
136
  size={10}
137
- style={{ marginStart: 12 }}
137
+ style={{ marginLeft: 12 }}
138
138
  color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
139
139
  >
140
140
  {t(item.gateway.toUpperCase(), item.name)}
@@ -151,19 +151,21 @@ const PaymentOptionsUI = (props: any) => {
151
151
  return (
152
152
  <PMContainer>
153
153
  {paymethodsList.paymethods.length > 0 && (
154
- <PMDropDownWrapper onPress={() => setShowMethods(true)}>
155
- <OText color={theme.colors.textSecondary} style={{marginStart: 14}}>{paymethodSelected?.paymethod?.name || t('SELECT_PAYMENT_METHOD', 'Select Paymethod')}</OText>
156
- <OIcon color={theme.colors.textSecondary} width={16} src={theme.images.general.chevron_right} style={{transform: [{rotate: '90deg'}], marginEnd: 14}} />
157
- {isShowMethods && <PMDropDownCont>
158
- {
159
- pmData.map((item: any, idx: number) =>
160
- <React.Fragment key={idx}>
161
- {renderPaymethods({item})}
162
- </React.Fragment>
163
- )
164
- }
165
- </PMDropDownCont>}
166
- </PMDropDownWrapper>
154
+ <View style={{ flexDirection: 'column' }}>
155
+ <PMDropDownWrapper onPress={() => setShowMethods(!isShowMethods)}>
156
+ <OText color={theme.colors.textSecondary} style={{marginLeft: 14}}>{paymethodSelected?.paymethod?.name || t('SELECT_PAYMENT_METHOD', 'Select Paymethod')}</OText>
157
+ <OIcon color={theme.colors.textSecondary} width={16} src={theme.images.general.chevron_right} style={{transform: [{rotate: '90deg'}], marginEnd: 14}} />
158
+ </PMDropDownWrapper>
159
+ {isShowMethods && (
160
+ <PMDropDownCont>
161
+ {pmData.map((item: any, idx: number) =>
162
+ <TouchableOpacity key={idx} onPress={() => console.log('asdasdasda')}>
163
+ {renderPaymethods({item})}
164
+ </TouchableOpacity>
165
+ )}
166
+ </PMDropDownCont>
167
+ )}
168
+ </View>
167
169
  )}
168
170
 
169
171
  {(paymethodsList.loading || isLoading) && (
@@ -66,11 +66,9 @@ export const PMDropDownWrapper = styled.TouchableOpacity`
66
66
  `;
67
67
 
68
68
  export const PMDropDownCont = styled.View`
69
- background-color: white;
70
- border-radius: 7.6px;
71
- position: absolute;
72
- top: 44px;
69
+ border-radius: 8px;
73
70
  width: 100%;
74
- padding: 10px 16px;
71
+ padding: 10px 0 0;
75
72
  box-shadow: 0 2px 3px #0000004D;
76
- `;
73
+ z-index: 99999;
74
+ `;
@@ -1,16 +1,17 @@
1
- import OText from './OText'
1
+ import OAlert from './OAlert'
2
+ import OBottomPopup from './OBottomPopup'
2
3
  import OButton from './OButton'
3
- import OInput from './OInput'
4
4
  import ODropDown from './ODropDown'
5
5
  import OIcon from './OIcon'
6
- import OIconText from './OIconText'
7
6
  import OIconButton from './OIconButton'
8
- import OTextarea from './OTextarea'
9
- import OToggle from './OToggle'
7
+ import OIconText from './OIconText'
8
+ import OInput from './OInput'
10
9
  import OKeyButton from './OKeyButton'
11
10
  import OModal from './OModal'
12
- import OAlert from './OAlert'
13
- import OBottomPopup from './OBottomPopup'
11
+ import OText from './OText'
12
+ import OTextarea from './OTextarea'
13
+ import { Toast } from './OToast'
14
+ import OToggle from './OToggle'
14
15
 
15
16
  export {
16
17
  OText,
@@ -24,6 +25,7 @@ export {
24
25
  OToggle,
25
26
  OKeyButton,
26
27
  OAlert,
27
- OModal,
28
+ OModal,
28
29
  OBottomPopup,
30
+ Toast
29
31
  }