ordering-ui-react-native 0.12.18 → 0.12.19
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 +1 -1
- package/src/config.json +2 -2
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +0 -389
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +0 -36
- package/themes/business/src/components 2/BusinessController/index.tsx +0 -155
- package/themes/business/src/components 2/BusinessController/styles.tsx +0 -19
- package/themes/business/src/components 2/Chat/index.tsx +0 -1152
- package/themes/business/src/components 2/Chat/styles.tsx +0 -12
- package/themes/business/src/components 2/Contacts/index.tsx +0 -299
- package/themes/business/src/components 2/Contacts/styles.tsx +0 -42
- package/themes/business/src/components 2/DriverMap/index.tsx +0 -525
- package/themes/business/src/components 2/FloatingButton/index.tsx +0 -141
- package/themes/business/src/components 2/FloatingButton/styles.tsx +0 -35
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +0 -204
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +0 -11
- package/themes/business/src/components 2/GoogleMap/index.tsx +0 -347
- package/themes/business/src/components 2/Home/index.tsx +0 -111
- package/themes/business/src/components 2/Home/styles.tsx +0 -27
- package/themes/business/src/components 2/LanguageSelector/index.tsx +0 -124
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +0 -152
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +0 -17
- package/themes/business/src/components 2/LoginForm/index.tsx +0 -663
- package/themes/business/src/components 2/LoginForm/styles.tsx +0 -48
- package/themes/business/src/components 2/LogoutButton/index.tsx +0 -63
- package/themes/business/src/components 2/MapView/index.tsx +0 -317
- package/themes/business/src/components 2/MessagesOption/index.tsx +0 -337
- package/themes/business/src/components 2/MessagesOption/styles.tsx +0 -27
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +0 -167
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +0 -8
- package/themes/business/src/components 2/NotFoundSource/index.tsx +0 -52
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +0 -17
- package/themes/business/src/components 2/OrderDetails/Business.tsx +0 -683
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +0 -454
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +0 -391
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +0 -148
- package/themes/business/src/components 2/OrderDetails/styles.tsx +0 -84
- package/themes/business/src/components 2/OrderMessage/index.tsx +0 -344
- package/themes/business/src/components 2/OrderMessage/styles.tsx +0 -5
- package/themes/business/src/components 2/OrderSummary/index.tsx +0 -700
- package/themes/business/src/components 2/OrderSummary/styles.tsx +0 -61
- package/themes/business/src/components 2/OrdersOption/index.tsx +0 -755
- package/themes/business/src/components 2/OrdersOption/styles.tsx +0 -54
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +0 -51
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +0 -35
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +0 -50
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +0 -49
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +0 -46
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +0 -8
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +0 -160
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +0 -3
- package/themes/business/src/components 2/PreviousMessages/index.tsx +0 -304
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +0 -32
- package/themes/business/src/components 2/PreviousOrders/index.tsx +0 -180
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +0 -38
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +0 -301
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +0 -61
- package/themes/business/src/components 2/SearchBar/index.tsx +0 -112
- package/themes/business/src/components 2/SignupForm/index.tsx +0 -530
- package/themes/business/src/components 2/SignupForm/styles.tsx +0 -16
- package/themes/business/src/components 2/StoresList/index.tsx +0 -208
- package/themes/business/src/components 2/StoresList/styles.tsx +0 -26
- package/themes/business/src/components 2/UserFormDetails/index.tsx +0 -513
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +0 -40
- package/themes/business/src/components 2/UserProfileForm/index.tsx +0 -496
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +0 -36
- package/themes/business/src/components 2/VerifyPhone/index.tsx +0 -201
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +0 -43
- package/themes/business/src/components 2/shared/OAlert.tsx +0 -52
- package/themes/business/src/components 2/shared/OButton.tsx +0 -149
- package/themes/business/src/components 2/shared/OChatBubble.tsx +0 -100
- package/themes/business/src/components 2/shared/ODropDown.tsx +0 -195
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +0 -328
- package/themes/business/src/components 2/shared/OFab.tsx +0 -54
- package/themes/business/src/components 2/shared/OIcon.tsx +0 -67
- package/themes/business/src/components 2/shared/OIconButton.tsx +0 -127
- package/themes/business/src/components 2/shared/OInput.tsx +0 -144
- package/themes/business/src/components 2/shared/OLink.tsx +0 -76
- package/themes/business/src/components 2/shared/OModal.tsx +0 -275
- package/themes/business/src/components 2/shared/OSegment.tsx +0 -86
- package/themes/business/src/components 2/shared/OText.tsx +0 -55
- package/themes/business/src/components 2/shared/OTextarea.tsx +0 -46
- package/themes/business/src/components 2/shared/OToast.tsx +0 -92
- package/themes/business/src/components 2/shared/index.tsx +0 -27
package/package.json
CHANGED
package/src/config.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"app_id": "react-native-app",
|
|
3
3
|
"notification_app": "orderingapp",
|
|
4
4
|
"app_name": "Ordering",
|
|
5
|
-
"project": "
|
|
5
|
+
"project": "reactdemo",
|
|
6
6
|
"api": {
|
|
7
|
-
"url": "https://apiv4
|
|
7
|
+
"url": "https://apiv4.ordering.co",
|
|
8
8
|
"language": "en",
|
|
9
9
|
"version": "v400"
|
|
10
10
|
},
|
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Linking,
|
|
4
|
-
Keyboard,
|
|
5
|
-
Platform,
|
|
6
|
-
View,
|
|
7
|
-
KeyboardAvoidingView,
|
|
8
|
-
TextInput
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import { useTheme } from 'styled-components/native';
|
|
11
|
-
import { useLanguage } from 'ordering-components/native';
|
|
12
|
-
import { Content, Timer, TimeField, Header, Action, Comments } from './styles';
|
|
13
|
-
import { FloatingButton } from '../FloatingButton';
|
|
14
|
-
import { OText, OButton, OTextarea, OIconButton } from '../shared';
|
|
15
|
-
import { AcceptOrRejectOrderParams } from '../../types';
|
|
16
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
17
|
-
|
|
18
|
-
export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
19
|
-
const {
|
|
20
|
-
customerCellphone,
|
|
21
|
-
loading,
|
|
22
|
-
action,
|
|
23
|
-
handleUpdateOrder,
|
|
24
|
-
actions,
|
|
25
|
-
closeModal,
|
|
26
|
-
orderId,
|
|
27
|
-
notShowCustomerPhone,
|
|
28
|
-
titleAccept,
|
|
29
|
-
titleReject,
|
|
30
|
-
appTitle,
|
|
31
|
-
} = props;
|
|
32
|
-
|
|
33
|
-
const [, t] = useLanguage();
|
|
34
|
-
const theme = useTheme();
|
|
35
|
-
const scrollViewRef = useRef<any>(null);
|
|
36
|
-
const viewRef = useRef<any>(null);
|
|
37
|
-
const timerRef = useRef() as React.MutableRefObject<TextInput>;
|
|
38
|
-
const textTareaRef = useRef<any>();
|
|
39
|
-
const [hour, setHour] = useState('00');
|
|
40
|
-
const [min, setMin] = useState('00');
|
|
41
|
-
const [time, setTime] = useState('');
|
|
42
|
-
const [comments, setComments] = useState('');
|
|
43
|
-
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
44
|
-
const phoneNumber = customerCellphone;
|
|
45
|
-
let codeNumberPhone, numberPhone, numberToShow;
|
|
46
|
-
const { top, bottom} = useSafeAreaInsets()
|
|
47
|
-
|
|
48
|
-
const handleFocus = () => {
|
|
49
|
-
viewRef?.current?.measure((x: any, y: any) => {
|
|
50
|
-
scrollViewRef?.current?.scrollTo({ x: 0, y });
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const handleFocusTimer = () => {
|
|
55
|
-
timerRef?.current?.measure((x: any, y: any) => {
|
|
56
|
-
scrollViewRef?.current?.scrollTo({ x: 0, y });
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
const keyboardDidShowListener = Keyboard.addListener(
|
|
62
|
-
'keyboardDidShow',
|
|
63
|
-
() => {
|
|
64
|
-
setIsKeyboardShow(true);
|
|
65
|
-
},
|
|
66
|
-
);
|
|
67
|
-
const keyboardDidHideListener = Keyboard.addListener(
|
|
68
|
-
'keyboardDidHide',
|
|
69
|
-
() => {
|
|
70
|
-
setIsKeyboardShow(false);
|
|
71
|
-
},
|
|
72
|
-
);
|
|
73
|
-
return () => {
|
|
74
|
-
keyboardDidShowListener.remove();
|
|
75
|
-
keyboardDidHideListener.remove();
|
|
76
|
-
};
|
|
77
|
-
}, []);
|
|
78
|
-
|
|
79
|
-
if (!notShowCustomerPhone) {
|
|
80
|
-
if (phoneNumber) {
|
|
81
|
-
codeNumberPhone = phoneNumber.slice(0, 3);
|
|
82
|
-
numberPhone = phoneNumber.slice(3, phoneNumber?.length);
|
|
83
|
-
numberToShow = `(${codeNumberPhone}) ${numberPhone}`;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const handleArrowBack: any = () => {
|
|
88
|
-
closeModal(false);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const handleTime = (e: any) => {
|
|
92
|
-
if (
|
|
93
|
-
e.includes(',') ||
|
|
94
|
-
e.includes('.') ||
|
|
95
|
-
e.includes('-') ||
|
|
96
|
-
e.includes(' ')
|
|
97
|
-
)
|
|
98
|
-
return;
|
|
99
|
-
|
|
100
|
-
setTime(e.slice(-4));
|
|
101
|
-
const mins = e.slice(-2);
|
|
102
|
-
const hours = e.slice(-4, -2);
|
|
103
|
-
|
|
104
|
-
setMin(mins);
|
|
105
|
-
setHour(hours);
|
|
106
|
-
setTime(`${hours}${mins}`);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (actions && action === 'accept') {
|
|
111
|
-
openTimerIOnput();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (actions && (action === 'reject' || action === 'failed')) {
|
|
115
|
-
openTextTareaOInput();
|
|
116
|
-
}
|
|
117
|
-
}, []);
|
|
118
|
-
|
|
119
|
-
const handleFixTime = () => {
|
|
120
|
-
if (min >= '60') {
|
|
121
|
-
setMin('59');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (min.length < 2) setMin(`0${min}`);
|
|
125
|
-
if (hour.length < 2) setHour(`0${hour}`);
|
|
126
|
-
|
|
127
|
-
if (!hour) setHour('00');
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const openTimerIOnput = () => {
|
|
131
|
-
const isFocus = timerRef.current.isFocused();
|
|
132
|
-
if (isFocus) {
|
|
133
|
-
timerRef.current.blur();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (!isFocus) {
|
|
137
|
-
if (time.length > 1) timerRef.current.clear();
|
|
138
|
-
timerRef.current.focus();
|
|
139
|
-
handleFocusTimer();
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const openTextTareaOInput = () => {
|
|
144
|
-
const isFocus = textTareaRef.current.isFocused();
|
|
145
|
-
if (isFocus && textTareaRef?.current) {
|
|
146
|
-
textTareaRef.current.blur();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (!isFocus && textTareaRef?.current) {
|
|
150
|
-
textTareaRef.current.focus();
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const handleAcceptOrReject = () => {
|
|
155
|
-
handleFixTime();
|
|
156
|
-
|
|
157
|
-
let minsToSend = min;
|
|
158
|
-
|
|
159
|
-
if (min > '60') minsToSend = '59';
|
|
160
|
-
|
|
161
|
-
const time = parseInt(hour || '0') * 60 + (parseInt(minsToSend) || 0);
|
|
162
|
-
|
|
163
|
-
let bodyToSend;
|
|
164
|
-
const orderStatus: any = {
|
|
165
|
-
acceptByBusiness: {
|
|
166
|
-
prepared_in: time,
|
|
167
|
-
status: 7,
|
|
168
|
-
},
|
|
169
|
-
rejectByBusiness: {
|
|
170
|
-
comment: comments,
|
|
171
|
-
status: 5,
|
|
172
|
-
},
|
|
173
|
-
acceptByDriver: {
|
|
174
|
-
delivered_in: time,
|
|
175
|
-
status: 8,
|
|
176
|
-
},
|
|
177
|
-
rejectByDriver: {
|
|
178
|
-
comment: comments,
|
|
179
|
-
status: 6,
|
|
180
|
-
},
|
|
181
|
-
failedByDriver: {
|
|
182
|
-
comment: comments,
|
|
183
|
-
status: 12
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
if (actions && action === 'accept') {
|
|
188
|
-
bodyToSend = orderStatus[actions.accept];
|
|
189
|
-
}
|
|
190
|
-
if (actions && action === 'reject') {
|
|
191
|
-
bodyToSend = orderStatus[actions.reject];
|
|
192
|
-
}
|
|
193
|
-
if(actions && action === 'failed'){
|
|
194
|
-
bodyToSend = orderStatus[actions.failed]
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
bodyToSend.id = orderId;
|
|
198
|
-
|
|
199
|
-
handleUpdateOrder && handleUpdateOrder(bodyToSend.status, bodyToSend);
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
return (
|
|
203
|
-
<KeyboardAvoidingView
|
|
204
|
-
enabled
|
|
205
|
-
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
206
|
-
style={{ flex: 1, paddingHorizontal: 30, paddingTop: 30, marginTop: top, marginBottom: bottom,justifyContent: 'space-between' }}>
|
|
207
|
-
<View>
|
|
208
|
-
<OIconButton
|
|
209
|
-
icon={theme.images.general.arrow_left}
|
|
210
|
-
borderColor={theme.colors.clear}
|
|
211
|
-
iconStyle={{ width: 20, height: 20 }}
|
|
212
|
-
style={{
|
|
213
|
-
maxWidth: 40,
|
|
214
|
-
height: 35,
|
|
215
|
-
justifyContent: 'flex-end',
|
|
216
|
-
marginBottom: 30,
|
|
217
|
-
}}
|
|
218
|
-
onClick={() => handleArrowBack()}
|
|
219
|
-
/>
|
|
220
|
-
<OText
|
|
221
|
-
size={20}
|
|
222
|
-
color={theme.colors.textGray}
|
|
223
|
-
style={{
|
|
224
|
-
fontFamily: 'Poppins',
|
|
225
|
-
fontStyle: 'normal',
|
|
226
|
-
}}
|
|
227
|
-
weight="600">
|
|
228
|
-
{action === 'accept'
|
|
229
|
-
? `${t(titleAccept?.key, titleAccept?.text)}:`
|
|
230
|
-
: t(titleReject?.key, titleReject?.text)}
|
|
231
|
-
</OText>
|
|
232
|
-
</View>
|
|
233
|
-
<Content showsVerticalScrollIndicator={false} ref={scrollViewRef}>
|
|
234
|
-
<Header>
|
|
235
|
-
{action === 'reject' && (
|
|
236
|
-
<>
|
|
237
|
-
{!notShowCustomerPhone && (
|
|
238
|
-
<>
|
|
239
|
-
<OText
|
|
240
|
-
size={15}
|
|
241
|
-
color={theme.colors.textGray}
|
|
242
|
-
style={{ marginTop: 10 }}>
|
|
243
|
-
{t(
|
|
244
|
-
'CALL_YOUR_CUSTOMER_TO_RESOLVE_THE_ISSUE_AS_POLITELY_AS_POSSIBLE',
|
|
245
|
-
'Call your customer to resolve the issue as politely as possible',
|
|
246
|
-
)}
|
|
247
|
-
</OText>
|
|
248
|
-
|
|
249
|
-
{numberToShow ? (
|
|
250
|
-
<OButton
|
|
251
|
-
bgColor="transparent"
|
|
252
|
-
borderColor={theme.colors.primary}
|
|
253
|
-
textStyle={{
|
|
254
|
-
color: theme.colors.primary,
|
|
255
|
-
fontSize: 20,
|
|
256
|
-
}}
|
|
257
|
-
style={{
|
|
258
|
-
borderRadius: 10,
|
|
259
|
-
marginVertical: 20,
|
|
260
|
-
}}
|
|
261
|
-
imgLeftStyle={{
|
|
262
|
-
resizeMode: 'contain',
|
|
263
|
-
left: 20,
|
|
264
|
-
position: 'absolute',
|
|
265
|
-
}}
|
|
266
|
-
imgLeftSrc={theme.images.general.cellphone}
|
|
267
|
-
text={numberToShow}
|
|
268
|
-
onClick={() =>
|
|
269
|
-
Linking.openURL(`tel:${customerCellphone}`)
|
|
270
|
-
}
|
|
271
|
-
/>
|
|
272
|
-
) : (
|
|
273
|
-
<OButton
|
|
274
|
-
bgColor="transparent"
|
|
275
|
-
borderColor={theme.colors.primary}
|
|
276
|
-
textStyle={{
|
|
277
|
-
color: theme.colors.primary,
|
|
278
|
-
fontSize: 15,
|
|
279
|
-
}}
|
|
280
|
-
style={{
|
|
281
|
-
borderRadius: 10,
|
|
282
|
-
marginVertical: 20,
|
|
283
|
-
}}
|
|
284
|
-
imgLeftStyle={{
|
|
285
|
-
resizeMode: 'contain',
|
|
286
|
-
left: 20,
|
|
287
|
-
position: 'absolute',
|
|
288
|
-
}}
|
|
289
|
-
isDisabled={true}
|
|
290
|
-
imgLeftSrc={theme.images.general.cellphone}
|
|
291
|
-
text={t('NOT_NUMBER', "There's not phonenumber.")}
|
|
292
|
-
onClick={() =>
|
|
293
|
-
Linking.openURL(`tel:${customerCellphone}`)
|
|
294
|
-
}
|
|
295
|
-
/>
|
|
296
|
-
)}
|
|
297
|
-
</>
|
|
298
|
-
)}
|
|
299
|
-
|
|
300
|
-
<OText
|
|
301
|
-
size={15}
|
|
302
|
-
color={theme.colors.textGray}
|
|
303
|
-
style={{ marginBottom: 10 }}>
|
|
304
|
-
{t(
|
|
305
|
-
'MARK_THE_ORDER_AS_REJECTED',
|
|
306
|
-
'Mark the order as rejected',
|
|
307
|
-
)}
|
|
308
|
-
</OText>
|
|
309
|
-
|
|
310
|
-
<OText>
|
|
311
|
-
<OText style={{ fontWeight: '600' }}>
|
|
312
|
-
{t('NOTE', 'Note')}
|
|
313
|
-
{': '}
|
|
314
|
-
</OText>
|
|
315
|
-
|
|
316
|
-
<OText size={15} color={theme.colors.textGray}>
|
|
317
|
-
{t(
|
|
318
|
-
'YOUR_CUSTOMER_WILL_RECEIVE_A_NOTIFICATION_ABOUT_THIS_ACTIONS',
|
|
319
|
-
'Your customer will receive a notification about this actions',
|
|
320
|
-
)}
|
|
321
|
-
</OText>
|
|
322
|
-
</OText>
|
|
323
|
-
</>
|
|
324
|
-
)}
|
|
325
|
-
</Header>
|
|
326
|
-
|
|
327
|
-
{action === 'accept' && (
|
|
328
|
-
<View style={{ height: 400, justifyContent: 'center' }}>
|
|
329
|
-
<Timer onPress={() => openTimerIOnput()}>
|
|
330
|
-
<OText weight="600" style={{ textAlign: 'center' }} size={55}>
|
|
331
|
-
{hour}
|
|
332
|
-
</OText>
|
|
333
|
-
{hour.length > 0 && <OText size={55}>:</OText>}
|
|
334
|
-
<OText weight="600" style={{ textAlign: 'center' }} size={55}>
|
|
335
|
-
{min}
|
|
336
|
-
</OText>
|
|
337
|
-
</Timer>
|
|
338
|
-
</View>
|
|
339
|
-
)}
|
|
340
|
-
<TimeField
|
|
341
|
-
ref={timerRef}
|
|
342
|
-
keyboardType="numeric"
|
|
343
|
-
value={time}
|
|
344
|
-
placeholder={'00:00'}
|
|
345
|
-
onChangeText={handleTime}
|
|
346
|
-
onPressOut={() => handleFixTime()}
|
|
347
|
-
editable={true}
|
|
348
|
-
autoFocus={actions && action === 'accept'}
|
|
349
|
-
selectionColor={theme.colors.primary}
|
|
350
|
-
placeholderTextColor={theme.colors.textGray}
|
|
351
|
-
color={theme.colors.textGray}
|
|
352
|
-
onEndEditing={handleFixTime}
|
|
353
|
-
/>
|
|
354
|
-
|
|
355
|
-
{(action === 'reject' || action === 'failed') && (
|
|
356
|
-
<Comments ref={viewRef}>
|
|
357
|
-
<OTextarea
|
|
358
|
-
textTareaRef={textTareaRef}
|
|
359
|
-
autoFocus={actions && (action === 'reject' || action === 'failed')}
|
|
360
|
-
onFocus={handleFocus}
|
|
361
|
-
placeholder={t(
|
|
362
|
-
'PLEASE_TYPE_YOUR_COMMENTS_IN_HERE',
|
|
363
|
-
'Please type your comments in here',
|
|
364
|
-
)}
|
|
365
|
-
value={comments}
|
|
366
|
-
onChange={setComments}
|
|
367
|
-
/>
|
|
368
|
-
<View style={{ height: 20 }} />
|
|
369
|
-
</Comments>
|
|
370
|
-
)}
|
|
371
|
-
</Content>
|
|
372
|
-
|
|
373
|
-
<Action>
|
|
374
|
-
<FloatingButton
|
|
375
|
-
firstButtonClick={() => {
|
|
376
|
-
handleAcceptOrReject();
|
|
377
|
-
}}
|
|
378
|
-
btnText={
|
|
379
|
-
action === 'accept'
|
|
380
|
-
? t('ACCEPT', 'Accept')
|
|
381
|
-
: t('REJECT', 'Reject')
|
|
382
|
-
}
|
|
383
|
-
color={action === 'accept' ? theme.colors.green : theme.colors.red}
|
|
384
|
-
widthButton={'100%'}
|
|
385
|
-
/>
|
|
386
|
-
</Action>
|
|
387
|
-
</KeyboardAvoidingView>
|
|
388
|
-
);
|
|
389
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const Content = styled.ScrollView`
|
|
4
|
-
background-color: ${(props: any) => props.theme.colors.white};
|
|
5
|
-
margin-bottom: 30px;
|
|
6
|
-
`;
|
|
7
|
-
|
|
8
|
-
export const Timer = styled.TouchableOpacity`
|
|
9
|
-
padding: 40px;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
flex-direction: row;
|
|
12
|
-
align-items: center;
|
|
13
|
-
width: 245px;
|
|
14
|
-
height: 245px;
|
|
15
|
-
background-color: ${(props: any) => props.theme.colors.inputChat};
|
|
16
|
-
border-radius: 123px;
|
|
17
|
-
align-self: center;
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
export const TimeField = styled.TextInput`
|
|
21
|
-
font-size: 55px;
|
|
22
|
-
font-family: 'Poppins-Regular';
|
|
23
|
-
font-weight: 600;
|
|
24
|
-
text-align: center;
|
|
25
|
-
width: 0;
|
|
26
|
-
height: 0;
|
|
27
|
-
opacity: 0;
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
export const Header = styled.View``;
|
|
31
|
-
|
|
32
|
-
export const Action = styled.View``;
|
|
33
|
-
|
|
34
|
-
export const Comments = styled.View`
|
|
35
|
-
margin-top: 20px;
|
|
36
|
-
`;
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { StyleSheet, View, ActivityIndicator } from 'react-native';
|
|
3
|
-
import ToggleSwitch from 'toggle-switch-react-native';
|
|
4
|
-
import { useTheme } from 'styled-components/native';
|
|
5
|
-
import {
|
|
6
|
-
BusinessController as BusinessSingleCard,
|
|
7
|
-
useUtils,
|
|
8
|
-
useLanguage,
|
|
9
|
-
ToastType,
|
|
10
|
-
useToast,
|
|
11
|
-
} from 'ordering-components/native';
|
|
12
|
-
import { Card, Information, Logo } from './styles';
|
|
13
|
-
import { OIcon, OText } from '../shared';
|
|
14
|
-
import { BusinessControllerParams } from '../../types';
|
|
15
|
-
|
|
16
|
-
export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
17
|
-
const { businessState, updateBusiness, isUpdateStore, setIsUpdateStore } =
|
|
18
|
-
props;
|
|
19
|
-
|
|
20
|
-
const { loading, business, error } = businessState;
|
|
21
|
-
|
|
22
|
-
const theme = useTheme();
|
|
23
|
-
const [{ optimizeImage }] = useUtils();
|
|
24
|
-
const [, t] = useLanguage();
|
|
25
|
-
const [, { showToast }] = useToast();
|
|
26
|
-
|
|
27
|
-
const [updatingBusiness, setUpdatingBusiness] = useState(false);
|
|
28
|
-
|
|
29
|
-
const handleSwitch = () => {
|
|
30
|
-
setUpdatingBusiness(true);
|
|
31
|
-
setIsUpdateStore(true);
|
|
32
|
-
|
|
33
|
-
updateBusiness &&
|
|
34
|
-
updateBusiness(business?.id, { enabled: !business?.enabled });
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (updatingBusiness && !error) {
|
|
39
|
-
showToast(
|
|
40
|
-
ToastType.Info,
|
|
41
|
-
business?.enabled
|
|
42
|
-
? t('ENABLED_BUSINESS', 'Enabled business')
|
|
43
|
-
: t('DISABLED_BUSINESS', 'Disabled business'),
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (error) {
|
|
48
|
-
showToast(
|
|
49
|
-
ToastType.Error,
|
|
50
|
-
t('ERROR_UPDATING_BUSINESS', 'Error updating business'),
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
setIsUpdateStore(false);
|
|
55
|
-
setUpdatingBusiness(false);
|
|
56
|
-
}, [business]);
|
|
57
|
-
|
|
58
|
-
const styles = StyleSheet.create({
|
|
59
|
-
icon: {
|
|
60
|
-
borderRadius: 7.6,
|
|
61
|
-
width: 70,
|
|
62
|
-
height: 70,
|
|
63
|
-
},
|
|
64
|
-
logo: {
|
|
65
|
-
padding: 2,
|
|
66
|
-
borderRadius: 18,
|
|
67
|
-
shadowColor: '#000',
|
|
68
|
-
shadowOffset: {
|
|
69
|
-
width: 0,
|
|
70
|
-
height: 1.5,
|
|
71
|
-
},
|
|
72
|
-
shadowOpacity: 0.21,
|
|
73
|
-
shadowRadius: 3,
|
|
74
|
-
elevation: 7,
|
|
75
|
-
},
|
|
76
|
-
header: {
|
|
77
|
-
flexDirection: 'row',
|
|
78
|
-
justifyContent: 'space-between',
|
|
79
|
-
width: '100%',
|
|
80
|
-
},
|
|
81
|
-
title: {
|
|
82
|
-
fontWeight: '600',
|
|
83
|
-
fontSize: 18,
|
|
84
|
-
color: theme.colors.textGray,
|
|
85
|
-
},
|
|
86
|
-
address: {
|
|
87
|
-
fontSize: 14,
|
|
88
|
-
color: theme.colors.unselectText,
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<>
|
|
94
|
-
{business && (
|
|
95
|
-
<Card key={business?.id}>
|
|
96
|
-
<View style={{ flex: 1, flexDirection: 'row', alignItems: 'center' }}>
|
|
97
|
-
<Logo style={styles.logo}>
|
|
98
|
-
<OIcon
|
|
99
|
-
url={optimizeImage(business?.logo, 'h_300,c_limit')}
|
|
100
|
-
style={styles.icon}
|
|
101
|
-
/>
|
|
102
|
-
</Logo>
|
|
103
|
-
|
|
104
|
-
<View
|
|
105
|
-
style={{
|
|
106
|
-
flex: 1,
|
|
107
|
-
flexDirection: 'row',
|
|
108
|
-
alignItems: 'flex-start',
|
|
109
|
-
}}>
|
|
110
|
-
<Information>
|
|
111
|
-
<View style={styles.header}>
|
|
112
|
-
<OText style={styles.title} numberOfLines={1}>
|
|
113
|
-
{business?.name}
|
|
114
|
-
</OText>
|
|
115
|
-
</View>
|
|
116
|
-
|
|
117
|
-
<OText style={styles.address} numberOfLines={1}>
|
|
118
|
-
{business?.address}
|
|
119
|
-
</OText>
|
|
120
|
-
|
|
121
|
-
<OText style={styles.address} numberOfLines={1}>
|
|
122
|
-
{business?.zipcode}
|
|
123
|
-
</OText>
|
|
124
|
-
</Information>
|
|
125
|
-
|
|
126
|
-
{loading && isUpdateStore ? (
|
|
127
|
-
<ActivityIndicator size="small" color={theme.colors.primary} />
|
|
128
|
-
) : (
|
|
129
|
-
<ToggleSwitch
|
|
130
|
-
isOn={business?.enabled}
|
|
131
|
-
onColor={theme.colors.primary}
|
|
132
|
-
offColor={theme.colors.offColor}
|
|
133
|
-
size="small"
|
|
134
|
-
onToggle={handleSwitch}
|
|
135
|
-
disabled={loading}
|
|
136
|
-
animationSpeed={200}
|
|
137
|
-
/>
|
|
138
|
-
)}
|
|
139
|
-
</View>
|
|
140
|
-
</View>
|
|
141
|
-
</Card>
|
|
142
|
-
)}
|
|
143
|
-
</>
|
|
144
|
-
);
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export const BusinessController = (props: BusinessControllerParams) => {
|
|
148
|
-
const BusinessControllerProps = {
|
|
149
|
-
...props,
|
|
150
|
-
isDisabledInterval: true,
|
|
151
|
-
UIComponent: BusinessControllerUI,
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
return <BusinessSingleCard {...BusinessControllerProps} />;
|
|
155
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const Card = styled.View`
|
|
4
|
-
flex: 1;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
align-items: flex-start;
|
|
7
|
-
flex-direction: row;
|
|
8
|
-
margin-bottom: 30px;
|
|
9
|
-
min-height: 64px;
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
export const Information = styled.View`
|
|
13
|
-
margin-horizontal: 10px;
|
|
14
|
-
flex: 1;
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
export const Logo = styled.View`
|
|
18
|
-
min-height: 64px;
|
|
19
|
-
`;
|