ordering-ui-react-native 0.21.78 → 0.21.79-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/PaymentOptionsWebView/index.tsx +1 -0
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +3 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/Chat/index.tsx +3 -1
- package/themes/business/src/components/DriverMap/index.tsx +44 -27
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +36 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +74 -24
- package/themes/business/src/components/OrderDetails/Business.tsx +65 -7
- package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -20
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +110 -40
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -35
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderSummary/index.tsx +222 -72
- package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
- package/themes/business/src/components/OrdersOption/index.tsx +247 -159
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +25 -15
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +84 -47
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +23 -5
- package/themes/business/src/utils/index.tsx +19 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +13 -1
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
- package/themes/original/src/components/BusinessController/index.tsx +12 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +38 -11
- package/themes/original/src/components/CartContent/index.tsx +21 -8
- package/themes/original/src/components/Checkout/index.tsx +108 -60
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +2 -10
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +1 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/MomentOption/index.tsx +13 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +139 -87
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -1
- package/themes/original/src/components/MyOrders/index.tsx +21 -26
- package/themes/original/src/components/NavBar/index.tsx +4 -2
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +1 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
- package/themes/original/src/components/OrderDetails/index.tsx +27 -10
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderSummary/index.tsx +28 -9
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +2 -4
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +17 -9
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +8 -1
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +86 -78
- package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +10 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +77 -60
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +3 -2
- package/themes/original/src/components/UserFormDetails/index.tsx +155 -131
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -36,7 +36,8 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
36
36
|
handleCancelEdit,
|
|
37
37
|
toggleIsEdit,
|
|
38
38
|
isCheckout,
|
|
39
|
-
isAlsea
|
|
39
|
+
isAlsea,
|
|
40
|
+
allowDriverUpdateData
|
|
40
41
|
} = props;
|
|
41
42
|
|
|
42
43
|
const theme = useTheme();
|
|
@@ -66,9 +67,9 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
66
67
|
const rules: any = {
|
|
67
68
|
required: isRequiredField(field.code)
|
|
68
69
|
? t(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`,
|
|
71
|
+
`${field.name} is required`,
|
|
72
|
+
).replace('_attribute_', t(field.name, field.code))
|
|
72
73
|
: null,
|
|
73
74
|
};
|
|
74
75
|
if (field.code && field.code === 'email') {
|
|
@@ -261,90 +262,93 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
261
262
|
sortInputFields({ values: validationFields?.fields?.checkout })
|
|
262
263
|
.length > 0 && (
|
|
263
264
|
<UDWrapper>
|
|
264
|
-
{
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
{
|
|
275
|
-
|
|
265
|
+
{allowDriverUpdateData && (
|
|
266
|
+
<>
|
|
267
|
+
{sortInputFields({
|
|
268
|
+
values: validationFields.fields?.checkout,
|
|
269
|
+
}).map(
|
|
270
|
+
(field: any) =>
|
|
271
|
+
showField &&
|
|
272
|
+
showField(field.code) &&
|
|
273
|
+
!isAlsea
|
|
274
|
+
&& (
|
|
275
|
+
<React.Fragment key={field.id}>
|
|
276
|
+
<OText style={styles.label}>
|
|
277
|
+
{t(field?.code.toUpperCase(), field?.name)}
|
|
278
|
+
</OText>
|
|
276
279
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
.toLowerCase()
|
|
310
|
-
.replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''),
|
|
311
|
-
);
|
|
312
|
-
field.code !== 'email'
|
|
313
|
-
? handleChangeInput(val)
|
|
314
|
-
: handleChangeInput({
|
|
315
|
-
target: {
|
|
316
|
-
name: 'email',
|
|
317
|
-
value: val.target.value
|
|
280
|
+
<Controller
|
|
281
|
+
key={field.id}
|
|
282
|
+
control={control}
|
|
283
|
+
render={() => (
|
|
284
|
+
<OInput
|
|
285
|
+
name={field.code}
|
|
286
|
+
placeholder={t(
|
|
287
|
+
field.code.toUpperCase(),
|
|
288
|
+
field?.name,
|
|
289
|
+
)}
|
|
290
|
+
placeholderTextColor={theme.colors.arrowColor}
|
|
291
|
+
style={styles.inputStyle}
|
|
292
|
+
icon={
|
|
293
|
+
field.code === 'email'
|
|
294
|
+
? theme.images.general.email
|
|
295
|
+
: theme.images.general.user
|
|
296
|
+
}
|
|
297
|
+
autoCapitalize={
|
|
298
|
+
field.code === 'email' ? 'none' : 'sentences'
|
|
299
|
+
}
|
|
300
|
+
isDisabled={!isEdit}
|
|
301
|
+
value={
|
|
302
|
+
formState?.changes[field.code] ??
|
|
303
|
+
(user && user[field.code]) ??
|
|
304
|
+
''
|
|
305
|
+
}
|
|
306
|
+
onChange={(val: any) => {
|
|
307
|
+
field.code !== 'email'
|
|
308
|
+
? setValue(field.code, val.target.value)
|
|
309
|
+
: setValue(
|
|
310
|
+
field.code,
|
|
311
|
+
val.target.value
|
|
318
312
|
.toLowerCase()
|
|
319
|
-
.replace(
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
313
|
+
.replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''),
|
|
314
|
+
);
|
|
315
|
+
field.code !== 'email'
|
|
316
|
+
? handleChangeInput(val)
|
|
317
|
+
: handleChangeInput({
|
|
318
|
+
target: {
|
|
319
|
+
name: 'email',
|
|
320
|
+
value: val.target.value
|
|
321
|
+
.toLowerCase()
|
|
322
|
+
.replace(
|
|
323
|
+
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
324
|
+
'',
|
|
325
|
+
),
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
}}
|
|
329
|
+
autoCorrect={field.code === 'email' && false}
|
|
330
|
+
type={
|
|
331
|
+
field.code === 'email'
|
|
332
|
+
? 'email-address'
|
|
333
|
+
: 'default'
|
|
334
|
+
}
|
|
335
|
+
returnKeyType="done"
|
|
336
|
+
autoCompleteType={
|
|
337
|
+
field.code === 'email' ? 'email' : 'off'
|
|
338
|
+
}
|
|
339
|
+
selectionColor={theme.colors.primary}
|
|
340
|
+
color={theme.colors.textGray}
|
|
341
|
+
/>
|
|
342
|
+
)}
|
|
343
|
+
name={field.code}
|
|
344
|
+
rules={getInputRules(field)}
|
|
345
|
+
defaultValue={user && user[field.code]}
|
|
338
346
|
/>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
/>
|
|
344
|
-
</React.Fragment>
|
|
345
|
-
),
|
|
347
|
+
</React.Fragment>
|
|
348
|
+
),
|
|
349
|
+
)}
|
|
350
|
+
</>
|
|
346
351
|
)}
|
|
347
|
-
|
|
348
352
|
<OText style={styles.label}>{t('PASSWORD', 'Password')}</OText>
|
|
349
353
|
|
|
350
354
|
<Controller
|
|
@@ -445,7 +449,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
445
449
|
</OText>
|
|
446
450
|
)}
|
|
447
451
|
|
|
448
|
-
{!!showInputPhoneNumber && !isAlsea && (
|
|
452
|
+
{!!showInputPhoneNumber && !isAlsea && allowDriverUpdateData && (
|
|
449
453
|
<WrapperPhone>
|
|
450
454
|
<PhoneInputNumber
|
|
451
455
|
data={phoneInputData}
|
|
@@ -487,28 +491,28 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
487
491
|
isEdit) ||
|
|
488
492
|
(watchPassword?.length > 0 && watchConfirmPassword?.length > 0) ||
|
|
489
493
|
formState?.loading) && (
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
494
|
+
<View style={{ flex: 1, marginLeft: 5 }}>
|
|
495
|
+
<OButton
|
|
496
|
+
text={
|
|
497
|
+
formState.loading
|
|
498
|
+
? t('UPDATING', 'Updating')
|
|
499
|
+
: t('UPDATE', 'Update')
|
|
500
|
+
}
|
|
501
|
+
bgColor={theme.colors.primary}
|
|
502
|
+
textStyle={{
|
|
503
|
+
...styles.btnText,
|
|
504
|
+
color: formState.loading
|
|
505
|
+
? theme.colors.textGray
|
|
506
|
+
: theme.colors.white,
|
|
507
|
+
}}
|
|
508
|
+
borderColor={theme.colors.primary}
|
|
509
|
+
isDisabled={formState.loading}
|
|
510
|
+
imgRightSrc={null}
|
|
511
|
+
style={styles.editButton}
|
|
512
|
+
onClick={handleSubmit(onSubmit)}
|
|
513
|
+
/>
|
|
514
|
+
</View>
|
|
515
|
+
)}
|
|
512
516
|
</EditButton>
|
|
513
517
|
)}
|
|
514
518
|
</>
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
useToast,
|
|
12
12
|
useLanguage,
|
|
13
13
|
useUtils,
|
|
14
|
+
useConfig,
|
|
15
|
+
useValidationFields
|
|
14
16
|
} from 'ordering-components/native';
|
|
15
17
|
import {
|
|
16
18
|
CenterView,
|
|
@@ -23,6 +25,7 @@ import { LogoutButton } from '../LogoutButton';
|
|
|
23
25
|
import { LanguageSelector } from '../LanguageSelector';
|
|
24
26
|
import { UserFormDetailsUI } from '../UserFormDetails';
|
|
25
27
|
import { DriverSchedule } from '../DriverSchedule'
|
|
28
|
+
import { PrinterSettings } from '../PrinterSettings'
|
|
26
29
|
import ToggleSwitch from 'toggle-switch-react-native';
|
|
27
30
|
import { UDWrapper } from '../UserFormDetails/styles';
|
|
28
31
|
import {
|
|
@@ -47,17 +50,20 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
47
50
|
cleanFormState,
|
|
48
51
|
handleToggleAvalaibleStatusDriver,
|
|
49
52
|
isAlsea,
|
|
50
|
-
|
|
53
|
+
isShowDriverStatus,
|
|
54
|
+
navigation
|
|
51
55
|
} = props;
|
|
52
56
|
|
|
53
57
|
const [{ user, sessionLoading }] = useSession();
|
|
54
58
|
const [, t] = useLanguage();
|
|
55
59
|
const [, { showToast }] = useToast();
|
|
56
60
|
const [{ optimizeImage }] = useUtils();
|
|
61
|
+
const [{ configs }] = useConfig();
|
|
62
|
+
const [{ loading }, { loadOriginalValidationFields }] = useValidationFields()
|
|
57
63
|
const { errors } = useForm();
|
|
58
64
|
const theme = useTheme();
|
|
59
65
|
|
|
60
|
-
const [phoneInputData, setPhoneInputData] = useState({
|
|
66
|
+
const [phoneInputData, setPhoneInputData] = useState<any>({
|
|
61
67
|
error: '',
|
|
62
68
|
phone: {
|
|
63
69
|
country_phone_code: null,
|
|
@@ -69,14 +75,11 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
69
75
|
const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
|
|
70
76
|
const [phoneToShow, setPhoneToShow] = useState('');
|
|
71
77
|
const [openModal, setOpenModal] = useState(false)
|
|
72
|
-
|
|
78
|
+
const allowDriverUpdateData = user?.level !== 4 || configs?.allow_driver_update_data?.value === "1"
|
|
73
79
|
useEffect(() => {
|
|
74
80
|
if (phoneInputData.phone.cellphone) {
|
|
75
|
-
const codeNumberPhone = phoneInputData.phone.
|
|
76
|
-
const numberPhone = phoneInputData.phone.cellphone
|
|
77
|
-
3,
|
|
78
|
-
phoneInputData.phone.cellphone?.length,
|
|
79
|
-
);
|
|
81
|
+
const codeNumberPhone = phoneInputData.phone.country_phone_code
|
|
82
|
+
const numberPhone = phoneInputData.phone.cellphone
|
|
80
83
|
setPhoneToShow(`(${codeNumberPhone}) ${numberPhone}`);
|
|
81
84
|
}
|
|
82
85
|
}, [phoneInputData.phone.cellphone]);
|
|
@@ -115,14 +118,14 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
115
118
|
includeBase64: true,
|
|
116
119
|
},
|
|
117
120
|
(image: any) => {
|
|
118
|
-
const response = image?.assets[0];
|
|
119
|
-
if (response
|
|
121
|
+
const response = image?.assets?.[0];
|
|
122
|
+
if (response?.didCancel) {
|
|
120
123
|
console.log('User cancelled image picker');
|
|
121
|
-
} else if (response
|
|
124
|
+
} else if (response?.errorMessage) {
|
|
122
125
|
console.log('ImagePicker Error: ', response.errorMessage);
|
|
123
126
|
showToast(ToastType.Error, response.errorMessage);
|
|
124
127
|
} else {
|
|
125
|
-
if (response
|
|
128
|
+
if (response?.uri) {
|
|
126
129
|
const url = `data:${response.type};base64,${response.base64}`;
|
|
127
130
|
handleButtonUpdateClick(null, true, url);
|
|
128
131
|
} else {
|
|
@@ -258,15 +261,17 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
258
261
|
|
|
259
262
|
return (
|
|
260
263
|
<>
|
|
261
|
-
{validationFields?.error && (
|
|
264
|
+
{validationFields?.error && !loading && (
|
|
262
265
|
<NotFoundSource
|
|
263
266
|
content={
|
|
264
|
-
validationFields?.error[0] ||
|
|
265
|
-
validationFields?.error[0]?.message ||
|
|
267
|
+
validationFields?.error?.[0] ||
|
|
268
|
+
validationFields?.error?.[0]?.message ||
|
|
266
269
|
t('NETWORK_ERROR', 'Network Error')
|
|
267
270
|
}
|
|
268
271
|
image={theme.images.general.notFound}
|
|
269
272
|
conditioned={false}
|
|
273
|
+
onClickButton={() => loadOriginalValidationFields({ forceLoading: true })}
|
|
274
|
+
btnTitle={t('REFRESH_PROFILE', 'Refresh profile')}
|
|
270
275
|
/>
|
|
271
276
|
)}
|
|
272
277
|
|
|
@@ -351,17 +356,18 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
351
356
|
height={150}
|
|
352
357
|
style={{ borderRadius: 7.2 }}
|
|
353
358
|
/>
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
{allowDriverUpdateData && (
|
|
360
|
+
<OIconButton
|
|
361
|
+
icon={theme.images.general.camera}
|
|
362
|
+
borderColor={theme.colors.clear}
|
|
363
|
+
iconStyle={{ width: 21, height: 21 }}
|
|
364
|
+
style={{ maxWidth: 40 }}
|
|
365
|
+
onClick={() => handleImagePicker()}
|
|
366
|
+
/>
|
|
367
|
+
)}
|
|
362
368
|
</CenterView>
|
|
363
369
|
|
|
364
|
-
{user?.level === 4 &&
|
|
370
|
+
{user?.level === 4 && (
|
|
365
371
|
<EnabledStatusDriver>
|
|
366
372
|
<View style={{ flex: 1 }}>
|
|
367
373
|
<OText
|
|
@@ -369,29 +375,33 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
369
375
|
adjustsFontSizeToFit
|
|
370
376
|
style={{ ...styles.label, paddingHorizontal: 0 }}>
|
|
371
377
|
{t(
|
|
372
|
-
'AVAILABLE_TO_RECEIVE_ORDERS
|
|
373
|
-
'Available to receive orders
|
|
378
|
+
`${!isShowDriverStatus ? 'NOT_' : ''}AVAILABLE_TO_RECEIVE_ORDERS`,
|
|
379
|
+
`${!isShowDriverStatus ? 'You are not ' : ''}Available to receive orders`
|
|
374
380
|
)}
|
|
375
381
|
</OText>
|
|
376
382
|
</View>
|
|
377
383
|
|
|
378
|
-
{
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
384
|
+
{isShowDriverStatus && (
|
|
385
|
+
<>
|
|
386
|
+
{userState.loadingDriver ? (
|
|
387
|
+
<ActivityIndicator size="small" color={theme.colors.primary} />
|
|
388
|
+
) : (
|
|
389
|
+
<ToggleSwitch
|
|
390
|
+
isOn={userState?.result?.result?.available}
|
|
391
|
+
onColor={theme.colors.primary}
|
|
392
|
+
offColor={theme.colors.offColor}
|
|
393
|
+
size="small"
|
|
394
|
+
onToggle={() =>
|
|
395
|
+
handleToggleAvalaibleStatusDriver &&
|
|
396
|
+
handleToggleAvalaibleStatusDriver(
|
|
397
|
+
!userState?.result?.result?.available,
|
|
398
|
+
)
|
|
399
|
+
}
|
|
400
|
+
disabled={userState?.loading}
|
|
401
|
+
animationSpeed={200}
|
|
402
|
+
/>
|
|
403
|
+
)}
|
|
404
|
+
</>
|
|
395
405
|
)}
|
|
396
406
|
</EnabledStatusDriver>
|
|
397
407
|
)}
|
|
@@ -454,7 +464,6 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
454
464
|
/>
|
|
455
465
|
|
|
456
466
|
<OText style={styles.label}>{t('PHONE', 'Phone')}</OText>
|
|
457
|
-
|
|
458
467
|
<OInput
|
|
459
468
|
isSecured={true}
|
|
460
469
|
placeholder={
|
|
@@ -477,6 +486,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
477
486
|
handleCancelEdit={handleCancelEdit}
|
|
478
487
|
toggleIsEdit={toggleIsEdit}
|
|
479
488
|
isAlsea={isAlsea}
|
|
489
|
+
allowDriverUpdateData={allowDriverUpdateData}
|
|
480
490
|
/>
|
|
481
491
|
</View>
|
|
482
492
|
)}
|
|
@@ -494,9 +504,34 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
494
504
|
/>
|
|
495
505
|
</EditButton>
|
|
496
506
|
)}
|
|
497
|
-
|
|
507
|
+
{!props.isBusinessApp ? (
|
|
508
|
+
<Pressable style={{ marginBottom: 10 }} onPress={() => setOpenModal(true)}>
|
|
509
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
510
|
+
<OText size={16}>{t('SCHEDULE', 'Schedule')}</OText>
|
|
511
|
+
<AntDesignIcon size={18} name='right' />
|
|
512
|
+
</View>
|
|
513
|
+
<View style={{
|
|
514
|
+
borderBottomColor: theme.colors.tabBar,
|
|
515
|
+
borderBottomWidth: 1,
|
|
516
|
+
marginTop: 10
|
|
517
|
+
}} />
|
|
518
|
+
</Pressable>
|
|
519
|
+
) : (
|
|
520
|
+
<Pressable style={{ marginBottom: 10 }} onPress={() => navigation.navigate('PrinterSetup')}>
|
|
521
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
522
|
+
<OText size={16}>{t('PRINTER_SETTINGS', 'Printer Settings')}</OText>
|
|
523
|
+
<AntDesignIcon size={18} name='right' />
|
|
524
|
+
</View>
|
|
525
|
+
<View style={{
|
|
526
|
+
borderBottomColor: theme.colors.tabBar,
|
|
527
|
+
borderBottomWidth: 1,
|
|
528
|
+
marginTop: 10
|
|
529
|
+
}} />
|
|
530
|
+
</Pressable>
|
|
531
|
+
)}
|
|
532
|
+
<Pressable style={{ marginBottom: 10 }} onPress={() => navigation.navigate('Sessions')}>
|
|
498
533
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
499
|
-
<OText size={16}>{t('
|
|
534
|
+
<OText size={16}>{t('SESSIONS', 'Sessions')}</OText>
|
|
500
535
|
<AntDesignIcon size={18} name='right' />
|
|
501
536
|
</View>
|
|
502
537
|
<View style={{
|
|
@@ -516,7 +551,9 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
516
551
|
entireModal
|
|
517
552
|
hideIcons
|
|
518
553
|
>
|
|
519
|
-
|
|
554
|
+
{!props.isBusinessApp && (
|
|
555
|
+
<DriverSchedule schedule={user?.schedule} />
|
|
556
|
+
)}
|
|
520
557
|
</OModal>
|
|
521
558
|
</ScrollView>
|
|
522
559
|
)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { useLanguage, useUtils, WebsocketStatus as WebsocketStatusController } from 'ordering-components/native'
|
|
3
|
-
import { TouchableOpacity, View, StyleSheet } from 'react-native'
|
|
3
|
+
import { TouchableOpacity, View, StyleSheet, Platform } from 'react-native'
|
|
4
4
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
5
5
|
import { useTheme } from 'styled-components/native'
|
|
6
6
|
import RNRestart from 'react-native-restart'
|
|
@@ -37,7 +37,7 @@ const SocketStatusUI = (props: any) => {
|
|
|
37
37
|
paddingLeft: 0,
|
|
38
38
|
paddingRight: 0,
|
|
39
39
|
marginBottom: 30,
|
|
40
|
-
marginTop: 30
|
|
40
|
+
marginTop: Platform.OS === 'ios' ? 60 : 30
|
|
41
41
|
},
|
|
42
42
|
})
|
|
43
43
|
|
|
@@ -64,6 +64,7 @@ interface Props extends TextInputProps {
|
|
|
64
64
|
onSubmitEditing?: any;
|
|
65
65
|
blurOnSubmit?: any;
|
|
66
66
|
color?: any;
|
|
67
|
+
isValueSync?: boolean
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
const OInput = (props: Props): React.ReactElement => {
|
|
@@ -118,6 +119,7 @@ const OInput = (props: Props): React.ReactElement => {
|
|
|
118
119
|
selectionColor={props.selectionColor}
|
|
119
120
|
color={props.color}
|
|
120
121
|
maxLength={props.maxLength || 1000}
|
|
122
|
+
value={props.isValueSync && props.value}
|
|
121
123
|
/>
|
|
122
124
|
|
|
123
125
|
{props.iconRight && (
|
|
@@ -4,8 +4,10 @@ import { useTheme } from 'styled-components/native';
|
|
|
4
4
|
|
|
5
5
|
const Wrapper = styled.View`
|
|
6
6
|
border-radius: 10px;
|
|
7
|
-
border: 1px
|
|
7
|
+
border-width: 1px;
|
|
8
|
+
border-color: ${(props: any) => props.theme.colors.lightGray};
|
|
8
9
|
`;
|
|
10
|
+
|
|
9
11
|
const Inner = styled.TextInput`
|
|
10
12
|
height: 100px;
|
|
11
13
|
padding: 5px 10px 5px 10px;
|
|
@@ -29,16 +31,13 @@ const OTextarea = (props: Props) => {
|
|
|
29
31
|
ref={props.textTareaRef}
|
|
30
32
|
onFocus={() => props.onFocus()}
|
|
31
33
|
onChangeText={(txt: any) => props.onChange(txt)}
|
|
32
|
-
textAlignVertical={'top'}
|
|
33
34
|
placeholder={props.placeholder}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
placeholderTextColor={theme.colors.lightGray}
|
|
36
|
+
numberOfLines={props.lines}
|
|
37
|
+
underlineColorAndroid={'transparent'}
|
|
38
|
+
value={props.value}
|
|
39
|
+
multiline={true}
|
|
38
40
|
autoFocus={props.autoFocus}
|
|
39
|
-
multiline={true}
|
|
40
|
-
selectionColor={theme.colors.primary}
|
|
41
|
-
color={theme.colors.textGray}
|
|
42
41
|
/>
|
|
43
42
|
</Wrapper>
|
|
44
43
|
);
|
|
@@ -48,8 +48,8 @@ export const useLocation = () => {
|
|
|
48
48
|
GeoLocation.getCurrentPosition(
|
|
49
49
|
({ coords }) => {
|
|
50
50
|
resolve({
|
|
51
|
-
latitude: coords.latitude,
|
|
52
|
-
longitude: coords.longitude,
|
|
51
|
+
latitude: typeof coords.latitude === 'number' && !Number.isNaN(coords.latitude) ? coords.latitude : 0,
|
|
52
|
+
longitude: typeof coords.longitude === 'number' && !Number.isNaN(coords.longitude) ? coords.longitude : 0,
|
|
53
53
|
speed: coords.speed,
|
|
54
54
|
});
|
|
55
55
|
},
|
|
@@ -63,9 +63,10 @@ export const useLocation = () => {
|
|
|
63
63
|
watchId.current = GeoLocation.watchPosition(
|
|
64
64
|
({ coords }) => {
|
|
65
65
|
if (!isMounted.current) return;
|
|
66
|
+
if (typeof coords.latitude !== 'number' || typeof coords.longitude !== 'number') return
|
|
66
67
|
const location: Location = {
|
|
67
|
-
latitude: coords.latitude,
|
|
68
|
-
longitude: coords.longitude,
|
|
68
|
+
latitude: coords.latitude || 0,
|
|
69
|
+
longitude: coords.longitude || 0,
|
|
69
70
|
speed: coords.speed,
|
|
70
71
|
};
|
|
71
72
|
setUserLocation(location);
|