ordering-ui-react-native 0.21.21 → 0.21.22-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 +7 -6
- 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 +4 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +2 -1
- package/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +23 -14
- package/themes/business/src/components/DriverMap/index.tsx +4 -3
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +4 -2
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/MapView/index.tsx +11 -7
- package/themes/business/src/components/MessagesOption/index.tsx +2 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +163 -113
- package/themes/business/src/components/OrderDetails/Business.tsx +50 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +23 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +60 -53
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +54 -23
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
- package/themes/business/src/components/OrderSummary/index.tsx +240 -76
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +125 -48
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +33 -36
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +18 -13
- package/themes/business/src/components/PreviousOrders/index.tsx +80 -66
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +17 -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/SearchBar/index.tsx +2 -1
- 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 +5 -3
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +98 -44
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +15 -2
- package/themes/business/src/utils/index.tsx +5 -0
- 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/LoginForm/index.tsx +7 -4
- 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 +9 -4
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +10 -6
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +4 -7
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- 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 +4 -4
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +20 -12
- package/themes/original/src/components/BusinessController/styles.tsx +8 -7
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +51 -20
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
- package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
- 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 +32 -9
- package/themes/original/src/components/CartContent/index.tsx +96 -58
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +190 -66
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/DatePicker/index.tsx +33 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +1 -1
- 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 +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- 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 +83 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleMap/index.tsx +6 -5
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +2 -1
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
- package/themes/original/src/components/Messages/index.tsx +9 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +4 -3
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
- package/themes/original/src/components/MyOrders/index.tsx +24 -29
- package/themes/original/src/components/NavBar/index.tsx +3 -1
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +716 -668
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderProgress/index.tsx +28 -6
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +3 -1
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +3 -5
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +3 -0
- package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +72 -6
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +74 -165
- package/themes/original/src/components/ProductItemAccordion/index.tsx +54 -44
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +123 -82
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +6 -1
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +4 -4
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SignupForm/index.tsx +60 -58
- package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
- package/themes/original/src/components/StripeElementsForm/index.tsx +72 -59
- package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserFormDetails/index.tsx +125 -77
- package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
- package/themes/original/src/components/UserProfile/index.tsx +3 -2
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +8 -9
- package/themes/original/src/components/Wallets/styles.tsx +1 -1
- package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -5
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/components/shared/OModal.tsx +12 -14
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +1 -0
- package/themes/original/src/utils/index.tsx +125 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import React, { useCallback } from 'react'
|
|
2
|
+
import { StyleSheet, View, TouchableOpacity } from 'react-native'
|
|
3
|
+
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import { OIcon, OText } from '../shared';
|
|
5
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
6
|
+
import ToggleSwitch from 'toggle-switch-react-native';
|
|
7
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
8
|
+
import { SearchBar } from '../SearchBar';
|
|
9
|
+
import { IOScrollView } from 'react-native-intersection-observer';
|
|
10
|
+
import {
|
|
11
|
+
useLanguage,
|
|
12
|
+
useUtils,
|
|
13
|
+
ToastType,
|
|
14
|
+
useToast,
|
|
15
|
+
} from 'ordering-components/native'
|
|
16
|
+
|
|
17
|
+
const PIXELS_TO_SCROLL = 2000
|
|
18
|
+
|
|
19
|
+
export const ProductList = (props: any) => {
|
|
20
|
+
const { productsList, onClose, updateProduct, searchValue, handleChangeSearch, getCategoryProducts } = props
|
|
21
|
+
|
|
22
|
+
const { loading, products, error } = productsList
|
|
23
|
+
|
|
24
|
+
const theme = useTheme()
|
|
25
|
+
const [{ optimizeImage }] = useUtils();
|
|
26
|
+
const [, { showToast }] = useToast()
|
|
27
|
+
const [, t] = useLanguage()
|
|
28
|
+
|
|
29
|
+
const styles = StyleSheet.create({
|
|
30
|
+
container: {
|
|
31
|
+
flex: 1,
|
|
32
|
+
marginBottom: 0
|
|
33
|
+
},
|
|
34
|
+
header: {
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
justifyContent: 'space-between',
|
|
37
|
+
marginBottom: 10,
|
|
38
|
+
},
|
|
39
|
+
btnBackArrow: {
|
|
40
|
+
borderWidth: 0,
|
|
41
|
+
width: 32,
|
|
42
|
+
height: 32,
|
|
43
|
+
tintColor: theme.colors.textGray,
|
|
44
|
+
backgroundColor: theme.colors.clear,
|
|
45
|
+
borderColor: theme.colors.clear,
|
|
46
|
+
shadowColor: theme.colors.clear,
|
|
47
|
+
paddingLeft: 0,
|
|
48
|
+
paddingRight: 0
|
|
49
|
+
},
|
|
50
|
+
sectionTitle: {
|
|
51
|
+
fontStyle: 'normal',
|
|
52
|
+
fontWeight: '600',
|
|
53
|
+
fontSize: 20,
|
|
54
|
+
color: theme.colors.textGray,
|
|
55
|
+
},
|
|
56
|
+
logo: {
|
|
57
|
+
padding: 2,
|
|
58
|
+
borderRadius: 18,
|
|
59
|
+
shadowColor: '#000',
|
|
60
|
+
shadowOffset: {
|
|
61
|
+
width: 0,
|
|
62
|
+
height: 1.5,
|
|
63
|
+
},
|
|
64
|
+
shadowOpacity: 0.21,
|
|
65
|
+
shadowRadius: 3,
|
|
66
|
+
elevation: 7,
|
|
67
|
+
},
|
|
68
|
+
icon: {
|
|
69
|
+
borderRadius: 7.6,
|
|
70
|
+
width: 35,
|
|
71
|
+
height: 35,
|
|
72
|
+
marginRight: 5
|
|
73
|
+
},
|
|
74
|
+
borderStyle: {
|
|
75
|
+
borderColor: theme.colors.red,
|
|
76
|
+
borderWidth: 0,
|
|
77
|
+
borderRadius: 10,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const handleSwitch = (enabled: boolean, categoryId: any, productId: any) => {
|
|
82
|
+
updateProduct && updateProduct(categoryId, productId, { enabled })
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const handleScroll = ({ nativeEvent }: any) => {
|
|
86
|
+
const y = nativeEvent.contentOffset.y;
|
|
87
|
+
const height = nativeEvent.contentSize.height;
|
|
88
|
+
const hasMore = !(
|
|
89
|
+
productsList.pagination.totalPages === productsList.pagination.currentPage
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
if (y + PIXELS_TO_SCROLL > height && !productsList.loading && hasMore && productsList?.products?.length > 0) {
|
|
93
|
+
getCategoryProducts(false)
|
|
94
|
+
showToast(ToastType.Info, t('LOADING_MORE_PRODUCTS', 'Loading more products'))
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<View style={{ flex: 1, paddingHorizontal: 20, paddingVertical: 20 }}>
|
|
100
|
+
<View style={styles.header}>
|
|
101
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
102
|
+
<TouchableOpacity
|
|
103
|
+
onPress={onClose}
|
|
104
|
+
style={styles.btnBackArrow}
|
|
105
|
+
>
|
|
106
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
|
|
107
|
+
</TouchableOpacity>
|
|
108
|
+
<OText style={styles.sectionTitle}>{t('PRODUCTS', 'Products')}</OText>
|
|
109
|
+
</View>
|
|
110
|
+
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
|
|
111
|
+
<SearchBar
|
|
112
|
+
borderStyle={styles.borderStyle}
|
|
113
|
+
onSearch={handleChangeSearch}
|
|
114
|
+
searchValue={searchValue}
|
|
115
|
+
lazyLoad
|
|
116
|
+
isCancelXButtonShow={!!searchValue}
|
|
117
|
+
onCancel={() => handleChangeSearch('')}
|
|
118
|
+
placeholder={t('SEARCH', 'Search')}
|
|
119
|
+
containerStyle={{ width: 180 }}
|
|
120
|
+
/>
|
|
121
|
+
</View>
|
|
122
|
+
</View>
|
|
123
|
+
<IOScrollView
|
|
124
|
+
style={styles.container}
|
|
125
|
+
onScroll={handleScroll}
|
|
126
|
+
scrollEventThrottle={16}
|
|
127
|
+
bounces={false}
|
|
128
|
+
>
|
|
129
|
+
{!loading && products?.length === 0 && (
|
|
130
|
+
<NotFoundSource
|
|
131
|
+
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
132
|
+
image={theme.images.general.notFound}
|
|
133
|
+
conditioned={false}
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
136
|
+
{!loading && products?.length > 0 && (
|
|
137
|
+
<View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
|
|
138
|
+
{products.map((product: any, i: number) => (
|
|
139
|
+
<View
|
|
140
|
+
key={i}
|
|
141
|
+
style={{
|
|
142
|
+
flexDirection: 'row',
|
|
143
|
+
justifyContent: 'space-between',
|
|
144
|
+
borderBottomColor: theme.colors.borderTops,
|
|
145
|
+
borderBottomWidth: 1,
|
|
146
|
+
paddingVertical: 15
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', marginRight: 36 }}>
|
|
150
|
+
<OIcon
|
|
151
|
+
url={optimizeImage(product?.images, 'h_300,c_limit')}
|
|
152
|
+
src={!product?.images && theme?.images?.dummies?.businessLogo}
|
|
153
|
+
style={styles.icon}
|
|
154
|
+
/>
|
|
155
|
+
<OText numberOfLines={2} size={12} ellipsizeMode='tail'>{product?.name}</OText>
|
|
156
|
+
</View>
|
|
157
|
+
<ToggleSwitch
|
|
158
|
+
isOn={product?.enabled}
|
|
159
|
+
onColor={theme.colors.primary}
|
|
160
|
+
offColor={theme.colors.offColor}
|
|
161
|
+
size="small"
|
|
162
|
+
onToggle={(value: boolean) => handleSwitch(value, product?.category_id, product.id)}
|
|
163
|
+
disabled={loading}
|
|
164
|
+
animationSpeed={200}
|
|
165
|
+
/>
|
|
166
|
+
</View>
|
|
167
|
+
))}
|
|
168
|
+
</View>
|
|
169
|
+
)}
|
|
170
|
+
{loading && (
|
|
171
|
+
<View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
|
|
172
|
+
{[...Array(6)].map((item, i) => (
|
|
173
|
+
<Placeholder key={i} Animation={Fade}>
|
|
174
|
+
<View
|
|
175
|
+
style={{
|
|
176
|
+
flex: 1,
|
|
177
|
+
flexDirection: 'row',
|
|
178
|
+
justifyContent: 'space-between',
|
|
179
|
+
alignItems: 'center',
|
|
180
|
+
marginBottom: 10,
|
|
181
|
+
borderBottomColor: theme.colors.borderTops,
|
|
182
|
+
borderBottomWidth: 1,
|
|
183
|
+
paddingVertical: 10
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
<PlaceholderLine width={50} />
|
|
187
|
+
<PlaceholderLine width={20} />
|
|
188
|
+
</View>
|
|
189
|
+
</Placeholder>
|
|
190
|
+
))}
|
|
191
|
+
</View>
|
|
192
|
+
)}
|
|
193
|
+
</IOScrollView>
|
|
194
|
+
</View>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, StyleSheet, ScrollView, Dimensions, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
4
|
+
import { useTheme } from 'styled-components/native';
|
|
5
|
+
import { SearchBar } from '../SearchBar';
|
|
6
|
+
import {
|
|
7
|
+
ToastType,
|
|
8
|
+
useToast,
|
|
9
|
+
useLanguage,
|
|
10
|
+
StoreProductList
|
|
11
|
+
} from 'ordering-components/native';
|
|
12
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
13
|
+
import { OText, OIcon } from '../shared';
|
|
14
|
+
import { IterateCategories } from './IterateCategories';
|
|
15
|
+
import { ProductList } from './ProductList'
|
|
16
|
+
|
|
17
|
+
const BusinessProductListUI = (props: any) => {
|
|
18
|
+
const {
|
|
19
|
+
navigation,
|
|
20
|
+
businessState,
|
|
21
|
+
productsList,
|
|
22
|
+
updateStoreCategory,
|
|
23
|
+
updateStoreProduct,
|
|
24
|
+
productSearch,
|
|
25
|
+
categorySearch,
|
|
26
|
+
handleChangeCategory,
|
|
27
|
+
handleChangeProductSearch,
|
|
28
|
+
handleChangeCategorySearch,
|
|
29
|
+
getCategoryProducts,
|
|
30
|
+
categories
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const { loading, error, business } = businessState;
|
|
34
|
+
|
|
35
|
+
const [, t] = useLanguage();
|
|
36
|
+
const [, { showToast }] = useToast();
|
|
37
|
+
const theme = useTheme();
|
|
38
|
+
|
|
39
|
+
const [showModal, setShowModal] = useState(false)
|
|
40
|
+
|
|
41
|
+
const handleOpenProducts = (category: any) => {
|
|
42
|
+
handleChangeCategory(category)
|
|
43
|
+
setShowModal(true)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (error) {
|
|
48
|
+
showToast(
|
|
49
|
+
ToastType.Error,
|
|
50
|
+
error || error[0] || t('NETWORK_ERROR', 'Network Error'),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}, [loading]);
|
|
54
|
+
|
|
55
|
+
const styles = StyleSheet.create({
|
|
56
|
+
container: {
|
|
57
|
+
paddingBottom: 20,
|
|
58
|
+
marginBottom: 0,
|
|
59
|
+
flex: 1,
|
|
60
|
+
},
|
|
61
|
+
header: {
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
justifyContent: 'space-between',
|
|
64
|
+
marginBottom: 10,
|
|
65
|
+
},
|
|
66
|
+
sectionTitle: {
|
|
67
|
+
fontStyle: 'normal',
|
|
68
|
+
fontWeight: '600',
|
|
69
|
+
fontSize: 20,
|
|
70
|
+
color: theme.colors.textGray,
|
|
71
|
+
},
|
|
72
|
+
borderStyle: {
|
|
73
|
+
borderColor: theme.colors.red,
|
|
74
|
+
borderWidth: 0,
|
|
75
|
+
borderRadius: 10,
|
|
76
|
+
},
|
|
77
|
+
btnBackArrow: {
|
|
78
|
+
borderWidth: 0,
|
|
79
|
+
width: 32,
|
|
80
|
+
height: 32,
|
|
81
|
+
tintColor: theme.colors.textGray,
|
|
82
|
+
backgroundColor: theme.colors.clear,
|
|
83
|
+
borderColor: theme.colors.clear,
|
|
84
|
+
shadowColor: theme.colors.clear,
|
|
85
|
+
paddingLeft: 0,
|
|
86
|
+
paddingRight: 0
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<>
|
|
92
|
+
<View style={styles.header}>
|
|
93
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
94
|
+
<TouchableOpacity
|
|
95
|
+
onPress={() => navigation?.canGoBack() && navigation.goBack()}
|
|
96
|
+
style={styles.btnBackArrow}
|
|
97
|
+
>
|
|
98
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
|
|
99
|
+
</TouchableOpacity>
|
|
100
|
+
<OText style={styles.sectionTitle}>{t('CATEGORIES', 'Categories')}</OText>
|
|
101
|
+
</View>
|
|
102
|
+
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
|
|
103
|
+
<SearchBar
|
|
104
|
+
borderStyle={styles.borderStyle}
|
|
105
|
+
onSearch={handleChangeCategorySearch}
|
|
106
|
+
searchValue={categorySearch}
|
|
107
|
+
lazyLoad
|
|
108
|
+
isCancelXButtonShow={!!categorySearch}
|
|
109
|
+
onCancel={() => handleChangeCategorySearch('')}
|
|
110
|
+
placeholder={t('SEARCH', 'Search')}
|
|
111
|
+
containerStyle={{ width: 180 }}
|
|
112
|
+
/>
|
|
113
|
+
</View>
|
|
114
|
+
</View>
|
|
115
|
+
<ScrollView
|
|
116
|
+
showsVerticalScrollIndicator={false}
|
|
117
|
+
style={styles.container}>
|
|
118
|
+
{!loading && business?.categories?.length === 0 && (
|
|
119
|
+
<NotFoundSource
|
|
120
|
+
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
121
|
+
image={theme.images.general.notFound}
|
|
122
|
+
conditioned={false}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
{!error && !loading && categories?.length > 0 && (
|
|
126
|
+
<View
|
|
127
|
+
style={{
|
|
128
|
+
borderTopColor: theme.colors.borderTops,
|
|
129
|
+
borderTopWidth: 1
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
<IterateCategories
|
|
133
|
+
list={categories}
|
|
134
|
+
handlerClickCategory={handleOpenProducts}
|
|
135
|
+
updateCategory={updateStoreCategory}
|
|
136
|
+
/>
|
|
137
|
+
</View>
|
|
138
|
+
)}
|
|
139
|
+
{loading && (
|
|
140
|
+
<View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
|
|
141
|
+
{[...Array(6)].map((item, i) => (
|
|
142
|
+
<Placeholder key={i} Animation={Fade}>
|
|
143
|
+
<View
|
|
144
|
+
style={{
|
|
145
|
+
flex: 1,
|
|
146
|
+
flexDirection: 'row',
|
|
147
|
+
justifyContent: 'space-between',
|
|
148
|
+
alignItems: 'center',
|
|
149
|
+
marginBottom: 10,
|
|
150
|
+
borderBottomColor: theme.colors.borderTops,
|
|
151
|
+
borderBottomWidth: 1,
|
|
152
|
+
paddingVertical: 10
|
|
153
|
+
}}
|
|
154
|
+
>
|
|
155
|
+
<PlaceholderLine width={50} />
|
|
156
|
+
<PlaceholderLine width={20} />
|
|
157
|
+
</View>
|
|
158
|
+
</Placeholder>
|
|
159
|
+
))}
|
|
160
|
+
</View>
|
|
161
|
+
)}
|
|
162
|
+
</ScrollView>
|
|
163
|
+
{showModal && (
|
|
164
|
+
<View
|
|
165
|
+
style={{
|
|
166
|
+
flex: 1,
|
|
167
|
+
position: 'absolute',
|
|
168
|
+
top: 0,
|
|
169
|
+
width: Dimensions.get('window').width,
|
|
170
|
+
height: Dimensions.get('window').height,
|
|
171
|
+
backgroundColor: theme.colors.backgroundLight,
|
|
172
|
+
left: 0
|
|
173
|
+
}}
|
|
174
|
+
>
|
|
175
|
+
<ProductList
|
|
176
|
+
productsList={productsList}
|
|
177
|
+
updateProduct={updateStoreProduct}
|
|
178
|
+
searchValue={productSearch}
|
|
179
|
+
handleChangeSearch={handleChangeProductSearch}
|
|
180
|
+
getCategoryProducts={getCategoryProducts}
|
|
181
|
+
onClose={() => setShowModal(false)}
|
|
182
|
+
/>
|
|
183
|
+
</View>
|
|
184
|
+
)}
|
|
185
|
+
</>
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const BusinessProductList = (props: any) => {
|
|
190
|
+
const businessProductListProps = {
|
|
191
|
+
...props,
|
|
192
|
+
UIComponent: BusinessProductListUI,
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
return <StoreProductList {...businessProductListProps} />;
|
|
196
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import styled from 'styled-components/native';
|
|
2
|
+
|
|
3
|
+
export const CategoryTab = styled.View`
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
padding-vertical: 10px;
|
|
7
|
+
border-bottom-color: ${(props: any) => props.theme.colors.borderTops};
|
|
8
|
+
border-bottom-width: 1px;
|
|
9
|
+
margin-left: ${(props: any) => props.isSpace ? '10px' : '0px'};
|
|
10
|
+
`
|
|
@@ -386,21 +386,30 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
386
386
|
style={{ ...styles.firstMessageText, textAlign: 'center' }}
|
|
387
387
|
>
|
|
388
388
|
{
|
|
389
|
-
message.change?.attribute
|
|
390
|
-
?
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
: message.change.new
|
|
389
|
+
message.change?.attribute === 'driver_group_id'
|
|
390
|
+
? message.change.old
|
|
391
|
+
? t('ORDER_ATTRIBUTE_CHANGED_FROM_TO')
|
|
392
|
+
.replace('_attribute_', t(message.change?.attribute.toUpperCase()).toLowerCase())
|
|
393
|
+
.replace('_from_', message.change.old)
|
|
394
|
+
.replace('_to_', message.change.new)
|
|
395
|
+
: t('ORDER_ATTRIBUTE_CHANGED_TO')
|
|
396
|
+
.replace('_attribute_', t(message.change?.attribute.toUpperCase()).toLowerCase())
|
|
397
|
+
.replace('_to_', message.change.new)
|
|
398
|
+
: message.change?.attribute !== 'driver_id'
|
|
400
399
|
?
|
|
401
|
-
`${
|
|
402
|
-
|
|
403
|
-
|
|
400
|
+
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
|
|
401
|
+
? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
|
|
402
|
+
: `${message.change?.attribute !== 'logistic_status'
|
|
403
|
+
? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
|
|
404
|
+
: message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
|
|
405
|
+
? t(ORDER_STATUS[parseInt(message.change.new, 10)])
|
|
406
|
+
: getLogisticTag(message.change.new)}`
|
|
407
|
+
}`
|
|
408
|
+
: message.change.new
|
|
409
|
+
?
|
|
410
|
+
`${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
|
|
411
|
+
:
|
|
412
|
+
`${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
|
|
404
413
|
}
|
|
405
414
|
</OText>
|
|
406
415
|
<OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
|
|
@@ -30,7 +30,6 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
30
30
|
isBusinessMarker,
|
|
31
31
|
isToFollow,
|
|
32
32
|
handleViewActionOrder,
|
|
33
|
-
updateDriverPosition,
|
|
34
33
|
driverUpdateLocation,
|
|
35
34
|
setDriverUpdateLocation,
|
|
36
35
|
} = props;
|
|
@@ -59,6 +58,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
59
58
|
key?: string | null;
|
|
60
59
|
}>({ open: false, content: [], key: null });
|
|
61
60
|
const distanceUnit = configState?.configs?.distance_unit?.value
|
|
61
|
+
const isHideRejectButtons = configState?.configs?.reject_orders_enabled && configState?.configs?.reject_orders_enabled?.value !== '1'
|
|
62
62
|
|
|
63
63
|
const {
|
|
64
64
|
hasLocation,
|
|
@@ -381,7 +381,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
381
381
|
<View style={styles.view}>
|
|
382
382
|
<OIcon
|
|
383
383
|
style={styles.image}
|
|
384
|
-
|
|
384
|
+
src={typeof location.icon === 'number' ? location.icon : { uri: location.icon }}
|
|
385
385
|
width={25}
|
|
386
386
|
height={25}
|
|
387
387
|
/>
|
|
@@ -539,8 +539,9 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
539
539
|
secondButton={true}
|
|
540
540
|
firstColorCustom={theme.colors.red}
|
|
541
541
|
secondColorCustom={theme.colors.green}
|
|
542
|
-
widthButton={'45%'}
|
|
542
|
+
widthButton={isHideRejectButtons ? '100%': '45%'}
|
|
543
543
|
isPadding
|
|
544
|
+
isHideRejectButtons={isHideRejectButtons}
|
|
544
545
|
/>
|
|
545
546
|
)}
|
|
546
547
|
|
|
@@ -25,6 +25,7 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
|
|
|
25
25
|
secondButton,
|
|
26
26
|
widthButton,
|
|
27
27
|
isPadding,
|
|
28
|
+
isHideRejectButtons
|
|
28
29
|
} = props;
|
|
29
30
|
|
|
30
31
|
const theme = useTheme();
|
|
@@ -61,39 +62,41 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
|
|
|
61
62
|
width: '100%',
|
|
62
63
|
justifyContent: 'space-between',
|
|
63
64
|
}}>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
|
|
65
|
+
{!isHideRejectButtons && (
|
|
66
|
+
<Button
|
|
67
|
+
secondButton={secondButton}
|
|
68
|
+
style={[
|
|
69
|
+
{
|
|
70
|
+
borderWidth: colorTxt1 ? 1 : 0,
|
|
71
|
+
borderColor: colorTxt1 ? colorTxt1 : null,
|
|
72
|
+
},
|
|
73
|
+
secondButton
|
|
74
|
+
? { backgroundColor: firstColorCustom || styles.primaryBtn }
|
|
75
|
+
: color
|
|
76
|
+
? { backgroundColor: color }
|
|
77
|
+
: styles.primaryBtn,
|
|
78
|
+
,
|
|
79
|
+
{ width: widthButton },
|
|
80
|
+
]}
|
|
81
|
+
onPress={firstButtonClick}
|
|
82
|
+
disabled={disabled}>
|
|
83
|
+
<OText color={theme.colors.white} size={16} mLeft={20}>
|
|
84
|
+
{btnLeftValueShow ? btnLeftValue : ''}
|
|
85
|
+
</OText>
|
|
84
86
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
<OText
|
|
88
|
+
style={styles.btnTextStyle}
|
|
89
|
+
color={colorTxt1 ? colorTxt1 : theme.colors.white}
|
|
90
|
+
numberOfLines={2}
|
|
91
|
+
adjustsFontSizeToFit>
|
|
92
|
+
{btnText}
|
|
93
|
+
</OText>
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
<OText color={theme.colors.white} size={16} mRight={20}>
|
|
96
|
+
{btnRightValueShow ? btnRightValue : ''}
|
|
97
|
+
</OText>
|
|
98
|
+
</Button>
|
|
99
|
+
)}
|
|
97
100
|
|
|
98
101
|
{secondButton && (
|
|
99
102
|
<Button
|
|
@@ -138,7 +138,10 @@ export const Home = (props: any) => {
|
|
|
138
138
|
placeholder={t('PROJECT_NAME', 'Project Name')}
|
|
139
139
|
icon={theme.images.general.project}
|
|
140
140
|
iconColor={theme.colors.arrowColor}
|
|
141
|
-
onChange={(e: any) =>
|
|
141
|
+
onChange={(e: any) => {
|
|
142
|
+
const project = e?.target?.value?.replace(/\s/g, '')
|
|
143
|
+
onChange(project)
|
|
144
|
+
}}
|
|
142
145
|
selectionColor={theme.colors.primary}
|
|
143
146
|
color={theme.colors.white}
|
|
144
147
|
value={value}
|
|
@@ -148,6 +151,7 @@ export const Home = (props: any) => {
|
|
|
148
151
|
autoCapitalize='none'
|
|
149
152
|
blurOnSubmit={false}
|
|
150
153
|
onSubmitEditing={() => handleSubmit(onSubmit)()}
|
|
154
|
+
isValueSync
|
|
151
155
|
/>
|
|
152
156
|
)}
|
|
153
157
|
/>
|
|
@@ -25,8 +25,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
25
25
|
value: language?.code,
|
|
26
26
|
label: language?.name,
|
|
27
27
|
inputLabel: language?.code.toUpperCase(),
|
|
28
|
-
countryCode: langCountries.find(item => item.value == language?.code)
|
|
29
|
-
?.countryCode,
|
|
28
|
+
countryCode: langCountries.find(item => item.value == language?.code)?.countryCode,
|
|
30
29
|
};
|
|
31
30
|
});
|
|
32
31
|
|
|
@@ -50,6 +49,9 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
50
49
|
},
|
|
51
50
|
});
|
|
52
51
|
|
|
52
|
+
console.log('_languages', _languages);
|
|
53
|
+
|
|
54
|
+
|
|
53
55
|
return (
|
|
54
56
|
<Container style={{ backgroundColor: theme.colors.inputChat }}>
|
|
55
57
|
{languagesState?.languages && (
|