ordering-ui-react-native 0.31.43-test → 0.33.43-test
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 +2 -1
- package/themes/business/src/components/MapView/index.tsx +6 -2
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/OrderDetails/index.tsx +7 -1
- package/themes/original/src/components/ProductForm/index.tsx +0 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +11 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.43-test",
|
|
4
4
|
"description": "Reusable components made in react native",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"author": "ordering.inc",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"react-native-color-matrix-image-filters": "^5.2.10",
|
|
78
78
|
"react-native-country-picker-modal": "^2.0.0",
|
|
79
79
|
"react-native-credit-card-input": "^0.4.1",
|
|
80
|
+
"react-native-date-picker": "^4.2.13",
|
|
80
81
|
"react-native-device-info": "^8.7.1",
|
|
81
82
|
"react-native-document-picker": "^5.2.0",
|
|
82
83
|
"react-native-elements": "^3.0.0-alpha.1",
|
|
@@ -132,6 +132,10 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
132
132
|
|
|
133
133
|
const RenderMarker = ({ marker, customer, orderIds }: { marker: any, customer?: boolean, orderIds?: Array<number> }) => {
|
|
134
134
|
const markerRef = useRef<any>()
|
|
135
|
+
|
|
136
|
+
let coordinateLat = (customer ? marker?.customer?.location?.lat : marker?.business?.location?.lat) ?? initialPosition?.latitude
|
|
137
|
+
let coordinateLng = (customer ? marker?.customer?.location?.lng : marker?.business?.location?.lng) ?? initialPosition?.longitude
|
|
138
|
+
|
|
135
139
|
useEffect(() => {
|
|
136
140
|
if (
|
|
137
141
|
markerRef?.current?.props?.coordinate?.latitude === locationSelected?.latitude &&
|
|
@@ -145,8 +149,8 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
145
149
|
<Marker
|
|
146
150
|
key={customer ? marker?.customer?.id : marker?.business?.id}
|
|
147
151
|
coordinate={{
|
|
148
|
-
latitude:
|
|
149
|
-
longitude:
|
|
152
|
+
latitude: coordinateLat,
|
|
153
|
+
longitude: coordinateLng
|
|
150
154
|
}}
|
|
151
155
|
onPress={() =>
|
|
152
156
|
setLocationSelected({
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import DatePicker from 'react-native-date-picker'
|
|
3
|
+
import { DateContainer } from './styles';
|
|
4
|
+
|
|
5
|
+
export const DatePickerUI = (props: any) => {
|
|
6
|
+
const {
|
|
7
|
+
birthdate,
|
|
8
|
+
handleChangeDate
|
|
9
|
+
} = props;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<DateContainer>
|
|
13
|
+
<DatePicker mode="date" date={birthdate ? new Date(birthdate) : new Date()} onDateChange={handleChangeDate} />
|
|
14
|
+
</DateContainer>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import styled from 'styled-components/native';
|
|
2
|
+
|
|
3
|
+
export const DateContainer = styled.View`
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
margin-bottom: 20px;
|
|
7
|
+
|
|
8
|
+
input {
|
|
9
|
+
border-radius: 20px;
|
|
10
|
+
width: 140px;
|
|
11
|
+
outline: none;
|
|
12
|
+
padding: 10px 15px;
|
|
13
|
+
border: 1px solid #E9ECEF;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.react-datepicker__triangle {
|
|
17
|
+
transform: translate(40px, 0px) !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
`
|
|
@@ -125,6 +125,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
125
125
|
const directionTypes = [2, 3, 4, 5]
|
|
126
126
|
const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
|
|
127
127
|
const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
|
|
128
|
+
const [isPickup, setIsPickup] = useState(order?.delivery_type === 2)
|
|
128
129
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
129
130
|
const isGiftCardOrder = !order?.business_id
|
|
130
131
|
const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
|
|
@@ -138,6 +139,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
138
139
|
const hideDriverMessages = theme?.confirmation?.components?.driver?.components?.messages?.hidden
|
|
139
140
|
const hideCustomerPhone = theme?.confirmation?.components?.customer?.components?.phone?.hidden
|
|
140
141
|
const hideCustomerAddress = theme?.confirmation?.components?.customer?.components?.address?.hidden
|
|
142
|
+
const progressBarObjt = isPickup ? getOrderStatuPickUp : getOrderStatus
|
|
141
143
|
const walletName: any = {
|
|
142
144
|
cash: {
|
|
143
145
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
@@ -346,7 +348,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
346
348
|
}
|
|
347
349
|
}, [props?.order?.error, props?.order?.loading])
|
|
348
350
|
|
|
349
|
-
|
|
351
|
+
|
|
352
|
+
useEffect(() => {
|
|
353
|
+
if (!order?.delivery_type) return
|
|
354
|
+
setIsPickup(order?.delivery_type === 2)
|
|
355
|
+
}, [order?.delivery_type])
|
|
350
356
|
|
|
351
357
|
return (
|
|
352
358
|
<OrderDetailsContainer
|
|
@@ -14,7 +14,7 @@ import { PhoneInputNumber } from '../PhoneInputNumber';
|
|
|
14
14
|
import { sortInputFields } from '../../utils';
|
|
15
15
|
import { ListItem } from '../UserProfile/styles';
|
|
16
16
|
import moment from 'moment';
|
|
17
|
-
import
|
|
17
|
+
import { DatePickerUI } from '../DatePicker';
|
|
18
18
|
|
|
19
19
|
export const UserFormDetailsUI = (props: any) => {
|
|
20
20
|
const {
|
|
@@ -84,6 +84,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
84
84
|
const [isChanged, setIsChanged] = useState(false)
|
|
85
85
|
const [isModalOpen, setIsModalOpen] = useState(false)
|
|
86
86
|
const [birthdate, setBirthdate] = useState(user?.birthdate ?? null)
|
|
87
|
+
const [showDatePicker, setShowDatePicker] = useState(false)
|
|
87
88
|
const [phoneInputData, setPhoneInputData] = useState({
|
|
88
89
|
error: '',
|
|
89
90
|
phone: {
|
|
@@ -215,6 +216,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
215
216
|
setBirthdate(date)
|
|
216
217
|
const _birthdate = moment(date).format('YYYY-MM-DD')
|
|
217
218
|
handleChangeInput({ target: { name: 'birthdate', value: _birthdate } })
|
|
219
|
+
setShowDatePicker(false)
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
const onRemoveAccount = () => {
|
|
@@ -383,28 +385,14 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
383
385
|
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
|
|
384
386
|
{t('BIRTHDATE', 'Birthdate')}
|
|
385
387
|
</OText>
|
|
386
|
-
<
|
|
387
|
-
{
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
isDisabled={formState.loading}
|
|
395
|
-
imgRightSrc={null}
|
|
396
|
-
style={{ borderRadius: 7.6, shadowOpacity: 0, borderWidth: 1, marginTop: 20, marginBottom: 20 }}
|
|
397
|
-
onClick={() => setDatePickerVisibility(true)}
|
|
398
|
-
/>
|
|
399
|
-
<DateContainer>
|
|
400
|
-
<DateTimePickerModal
|
|
401
|
-
isVisible={isDatePickerVisible}
|
|
402
|
-
mode="date"
|
|
403
|
-
date={birthdate ? new Date(birthdate) : new Date()}
|
|
404
|
-
onConfirm={_handleChangeDate}
|
|
405
|
-
onCancel={() => setDatePickerVisibility(false)}
|
|
406
|
-
/>
|
|
407
|
-
</DateContainer>
|
|
388
|
+
<TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
|
|
389
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ alignSelf: 'flex-start' }}>
|
|
390
|
+
{birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
|
|
391
|
+
</OText>
|
|
392
|
+
</TouchableOpacity>
|
|
393
|
+
{showDatePicker && (
|
|
394
|
+
<DatePickerUI birthdate={birthdate} handleChangeDate={_handleChangeDate} />
|
|
395
|
+
)}
|
|
408
396
|
</WrapperPhone>
|
|
409
397
|
)}
|
|
410
398
|
{!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
|