ordering-ui-react-native 0.15.56 → 0.15.58-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 +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessTypeFilter/index.tsx +3 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/PaymentOptions/index.tsx +67 -50
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SignupForm/index.tsx +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeMethodForm/index.tsx +1 -2
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +12 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- package/src/utils/index.tsx +68 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +42 -90
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +41 -7
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +5 -2
- package/themes/business/src/components/PreviousOrders/index.tsx +2 -2
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +6 -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/BusinessMenu/index.tsx +39 -28
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +11 -12
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
- package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
- package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +1 -0
- package/themes/original/index.tsx +169 -4
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +7 -6
- package/themes/original/src/components/AddressList/index.tsx +30 -18
- package/themes/original/src/components/AppleLogin/index.tsx +9 -13
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +136 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
- package/themes/original/src/components/BusinessController/index.tsx +48 -11
- package/themes/original/src/components/BusinessController/styles.tsx +27 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +119 -35
- package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -4
- package/themes/original/src/components/BusinessProductsListing/index.tsx +109 -21
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +127 -66
- package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
- package/themes/original/src/components/Cart/index.tsx +60 -41
- package/themes/original/src/components/Checkout/index.tsx +48 -32
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +11 -11
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +332 -164
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +120 -32
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +135 -49
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +130 -38
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +57 -36
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +70 -62
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/Promotions/index.tsx +151 -133
- package/themes/original/src/components/Promotions/styles.tsx +3 -23
- package/themes/original/src/components/SearchBar/index.tsx +10 -4
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SignupForm/index.tsx +269 -130
- package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
- package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +5 -96
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +53 -6
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +76 -9
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +192 -33
- package/themes/original/src/utils/index.tsx +85 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -113,7 +113,10 @@ const CheckoutUI = (props: any) => {
|
|
|
113
113
|
right: Platform.OS === 'ios' ? 5 : (I18nManager.isRTL ? 30 : 0),
|
|
114
114
|
position: 'absolute',
|
|
115
115
|
fontSize: 20
|
|
116
|
-
}
|
|
116
|
+
},
|
|
117
|
+
wrapperNavbar: Platform.OS === 'ios'
|
|
118
|
+
? { paddingVertical: 0, paddingHorizontal: 40 }
|
|
119
|
+
: { paddingVertical: 20, paddingHorizontal: 40 }
|
|
117
120
|
})
|
|
118
121
|
|
|
119
122
|
const [, { showToast }] = useToast();
|
|
@@ -133,11 +136,21 @@ const CheckoutUI = (props: any) => {
|
|
|
133
136
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
134
137
|
const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
|
|
135
138
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
136
|
-
|
|
139
|
+
|
|
137
140
|
const placeSpotTypes = [3, 4]
|
|
138
|
-
const
|
|
141
|
+
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
142
|
+
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
143
|
+
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
144
|
+
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
145
|
+
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
146
|
+
|
|
139
147
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
140
|
-
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
|
|
148
|
+
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
|
|
149
|
+
cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
150
|
+
(options.type === 1 &&
|
|
151
|
+
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
152
|
+
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
153
|
+
(Number(cart?.driver_tip) <= 0))
|
|
141
154
|
|
|
142
155
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
143
156
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -159,9 +172,9 @@ const CheckoutUI = (props: any) => {
|
|
|
159
172
|
}
|
|
160
173
|
}
|
|
161
174
|
|
|
162
|
-
const handlePlaceOrder = () => {
|
|
175
|
+
const handlePlaceOrder = (confirmPayment) => {
|
|
163
176
|
if (!userErrors.length) {
|
|
164
|
-
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
177
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
|
|
165
178
|
return
|
|
166
179
|
}
|
|
167
180
|
let stringError = ''
|
|
@@ -239,7 +252,7 @@ const CheckoutUI = (props: any) => {
|
|
|
239
252
|
|
|
240
253
|
useEffect(() => {
|
|
241
254
|
if (cart?.products?.length === 0) {
|
|
242
|
-
|
|
255
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
243
256
|
}
|
|
244
257
|
}, [cart?.products])
|
|
245
258
|
|
|
@@ -250,13 +263,18 @@ const CheckoutUI = (props: any) => {
|
|
|
250
263
|
return (
|
|
251
264
|
<>
|
|
252
265
|
<Container noPadding>
|
|
253
|
-
<
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
266
|
+
<View style={styles.wrapperNavbar}>
|
|
267
|
+
<NavBar
|
|
268
|
+
title={t('CHECKOUT', 'Checkout')}
|
|
269
|
+
titleAlign={'center'}
|
|
270
|
+
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
271
|
+
showCall={false}
|
|
272
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
273
|
+
style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
|
|
274
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
275
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
276
|
+
/>
|
|
277
|
+
</View>
|
|
260
278
|
<ChContainer style={styles.pagePadding}>
|
|
261
279
|
<ChSection style={{ paddingTop: 0 }}>
|
|
262
280
|
<ChHeader>
|
|
@@ -597,7 +615,7 @@ const CheckoutUI = (props: any) => {
|
|
|
597
615
|
</OText>
|
|
598
616
|
</TouchableOpacity>
|
|
599
617
|
</CartHeader>
|
|
600
|
-
{
|
|
618
|
+
{isBusinessChangeEnabled && (
|
|
601
619
|
<TouchableOpacity
|
|
602
620
|
onPress={() => setOpenChangeStore(true)}
|
|
603
621
|
style={{ alignSelf: 'flex-start' }}
|
|
@@ -625,7 +643,7 @@ const CheckoutUI = (props: any) => {
|
|
|
625
643
|
|
|
626
644
|
{!cartState.loading && cart && (
|
|
627
645
|
<View>
|
|
628
|
-
<ChErrors style={{ marginBottom:
|
|
646
|
+
<ChErrors style={{ marginBottom: 10 }}>
|
|
629
647
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
630
648
|
<OText
|
|
631
649
|
color={theme.colors.error}
|
|
@@ -649,7 +667,7 @@ const CheckoutUI = (props: any) => {
|
|
|
649
667
|
color={theme.colors.error}
|
|
650
668
|
size={12}
|
|
651
669
|
>
|
|
652
|
-
{t('
|
|
670
|
+
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
653
671
|
</OText>
|
|
654
672
|
)}
|
|
655
673
|
{placeSpotTypes.includes(options?.type) && !cart?.place && (
|
|
@@ -660,11 +678,22 @@ const CheckoutUI = (props: any) => {
|
|
|
660
678
|
{t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
|
|
661
679
|
</OText>
|
|
662
680
|
)}
|
|
681
|
+
{options.type === 1 &&
|
|
682
|
+
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
683
|
+
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
684
|
+
(Number(cart?.driver_tip) <= 0) && (
|
|
685
|
+
<OText
|
|
686
|
+
color={theme.colors.error}
|
|
687
|
+
size={12}
|
|
688
|
+
>
|
|
689
|
+
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
690
|
+
</OText>
|
|
691
|
+
)}
|
|
663
692
|
</ChErrors>
|
|
664
693
|
</View>
|
|
665
694
|
)}
|
|
666
695
|
<OModal
|
|
667
|
-
open={openChangeStore
|
|
696
|
+
open={openChangeStore}
|
|
668
697
|
entireModal
|
|
669
698
|
customClose
|
|
670
699
|
onClose={() => setOpenChangeStore(false)}
|
|
@@ -708,19 +737,6 @@ const CheckoutUI = (props: any) => {
|
|
|
708
737
|
setShowGateway={setShowGateway}
|
|
709
738
|
/>
|
|
710
739
|
)}
|
|
711
|
-
{webviewPaymethod?.gateway === 'square' && showGateway.open && (
|
|
712
|
-
<PaymentOptionsWebView
|
|
713
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
714
|
-
uri={`https://test-square-f50f7.web.app`}
|
|
715
|
-
user={user}
|
|
716
|
-
token={token}
|
|
717
|
-
cart={cart}
|
|
718
|
-
currency={currency}
|
|
719
|
-
webviewPaymethod={webviewPaymethod}
|
|
720
|
-
setShowGateway={setShowGateway}
|
|
721
|
-
locationId={'L1NGAY5M6KJRX'}
|
|
722
|
-
/>
|
|
723
|
-
)}
|
|
724
740
|
</>
|
|
725
741
|
)
|
|
726
742
|
}
|
|
@@ -873,7 +889,7 @@ export const Checkout = (props: any) => {
|
|
|
873
889
|
...props,
|
|
874
890
|
UIComponent: CheckoutUI,
|
|
875
891
|
cartState,
|
|
876
|
-
|
|
892
|
+
uuid: cartUuid
|
|
877
893
|
}
|
|
878
894
|
|
|
879
895
|
return (
|
|
@@ -48,22 +48,28 @@ const DriverTipsUI = (props: any) => {
|
|
|
48
48
|
}
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
const [value, setvalue] = useState(
|
|
51
|
+
const [value, setvalue] = useState('');
|
|
52
52
|
|
|
53
53
|
const placeholderCurrency = (configs?.currency_position?.value || 'left') === 'left'
|
|
54
54
|
? `${configs?.format_number_currency?.value}0`
|
|
55
55
|
: `0${configs?.format_number_currency?.value}`
|
|
56
56
|
|
|
57
57
|
const handleChangeDriverTip = (val: any) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
const tip = Number(val)
|
|
59
|
+
if ((isNaN(tip) || tip < 0)) {
|
|
60
|
+
setvalue(value)
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
setvalue(val)
|
|
61
64
|
}
|
|
62
|
-
|
|
65
|
+
|
|
63
66
|
return (
|
|
64
67
|
<DTContainer>
|
|
68
|
+
<DTLabel>
|
|
69
|
+
{t('CUSTOM_DRIVER_TIP_MESSAGE', '100% of these tips go directly to your driver')}
|
|
70
|
+
</DTLabel>
|
|
65
71
|
<DTWrapperTips>
|
|
66
|
-
{driverTipsOptions.map((option: any, i: number) => (
|
|
72
|
+
{!isDriverTipUseCustom && driverTipsOptions.map((option: any, i: number) => (
|
|
67
73
|
<TouchableOpacity
|
|
68
74
|
key={i}
|
|
69
75
|
onPress={() => handlerChangeOption(option)}
|
|
@@ -79,7 +85,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
79
85
|
</TouchableOpacity>
|
|
80
86
|
))}
|
|
81
87
|
</DTWrapperTips>
|
|
82
|
-
{!driverTipsOptions.includes(driverTip) && driverTip > 0 && (
|
|
88
|
+
{(!isDriverTipUseCustom && !driverTipsOptions.includes(driverTip) && driverTip > 0) && (
|
|
83
89
|
<OText
|
|
84
90
|
color={theme.colors.error}
|
|
85
91
|
size={16}
|
|
@@ -90,13 +96,12 @@ const DriverTipsUI = (props: any) => {
|
|
|
90
96
|
)}
|
|
91
97
|
{isDriverTipUseCustom && (
|
|
92
98
|
<DTForm>
|
|
93
|
-
<DTLabel>
|
|
94
|
-
{t('CUSTOM_DRIVER_TIP_MESSAGE', '100% of these tips go directly to your driver')}
|
|
95
|
-
</DTLabel>
|
|
96
99
|
<DTWrapperInput>
|
|
97
100
|
<OInput
|
|
98
101
|
placeholder={placeholderCurrency}
|
|
99
102
|
style={style.inputStyle}
|
|
103
|
+
value={value}
|
|
104
|
+
type={'numeric'}
|
|
100
105
|
onChange={handleChangeDriverTip}
|
|
101
106
|
autoCapitalize='none'
|
|
102
107
|
autoCorrect={false}
|
|
@@ -108,10 +113,10 @@ const DriverTipsUI = (props: any) => {
|
|
|
108
113
|
textStyle={{ color: 'white', fontSize: 14 }}
|
|
109
114
|
imgRightSrc={null}
|
|
110
115
|
style={{ borderRadius: 5, height: 44 }}
|
|
111
|
-
isDisabled={
|
|
116
|
+
isDisabled={parseFloat(value || '0') < 0 || parseFloat(value || '0') === driverTip || value === ''}
|
|
112
117
|
onClick={() => {
|
|
113
118
|
handlerChangeOption(value)
|
|
114
|
-
setvalue(
|
|
119
|
+
setvalue('')
|
|
115
120
|
}}
|
|
116
121
|
/>
|
|
117
122
|
</DTWrapperInput>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { useLanguage, useOrder } from 'ordering-components/native'
|
|
3
|
+
import { useTheme } from 'styled-components/native'
|
|
4
|
+
import { FavoriteList } from '../FavoriteList'
|
|
5
|
+
import NavBar from '../NavBar'
|
|
6
|
+
import { OText } from '../shared'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
TabContainer,
|
|
10
|
+
Tab,
|
|
11
|
+
Container
|
|
12
|
+
} from './styles'
|
|
13
|
+
|
|
14
|
+
export const Favorite = (props: any) => {
|
|
15
|
+
const {
|
|
16
|
+
navigation
|
|
17
|
+
} = props
|
|
18
|
+
const [, t] = useLanguage()
|
|
19
|
+
const theme = useTheme()
|
|
20
|
+
const [orderState] = useOrder()
|
|
21
|
+
const [tabSelected, setTabSelected] = useState('businesses')
|
|
22
|
+
|
|
23
|
+
const tabList = [
|
|
24
|
+
{ key: 'businesses', name: t('BUSINESSES', 'Businesses') },
|
|
25
|
+
{ key: 'products', name: t('PRODUCTS', 'Products') },
|
|
26
|
+
{ key: 'orders', name: t('ORDERS', 'Orders') }
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
30
|
+
|
|
31
|
+
const onRedirect = (route: string, params?: any) => {
|
|
32
|
+
navigation.navigate(route, params)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Container>
|
|
37
|
+
<NavBar
|
|
38
|
+
title={t('FAVORITE', 'Favorite')}
|
|
39
|
+
titleAlign={'center'}
|
|
40
|
+
onActionLeft={goToBack}
|
|
41
|
+
showCall={false}
|
|
42
|
+
paddingTop={10}
|
|
43
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
44
|
+
/>
|
|
45
|
+
<TabContainer>
|
|
46
|
+
{tabList.map((menu, i) => (
|
|
47
|
+
<Tab
|
|
48
|
+
key={i}
|
|
49
|
+
active={menu.key === tabSelected}
|
|
50
|
+
onPress={() => setTabSelected(menu.key)}
|
|
51
|
+
>
|
|
52
|
+
<OText
|
|
53
|
+
color={menu.key === tabSelected ? theme.colors.textNormal : theme.colors.disabled}
|
|
54
|
+
size={14}
|
|
55
|
+
weight={menu.key === tabSelected ? '500' : '400'}
|
|
56
|
+
style={{ marginBottom: 12 }}
|
|
57
|
+
>
|
|
58
|
+
{menu.name}
|
|
59
|
+
</OText>
|
|
60
|
+
</Tab>
|
|
61
|
+
))}
|
|
62
|
+
</TabContainer>
|
|
63
|
+
{tabSelected === 'businesses' && (
|
|
64
|
+
<FavoriteList
|
|
65
|
+
navigation={navigation}
|
|
66
|
+
onNavigationRedirect={onRedirect}
|
|
67
|
+
isBusiness
|
|
68
|
+
favoriteURL='favorite_businesses'
|
|
69
|
+
originalURL='business'
|
|
70
|
+
location={`${orderState.options?.address?.location?.lat},${orderState.options?.address?.location?.lng}`}
|
|
71
|
+
propsToFetch={['id', 'name', 'header', 'logo', 'location', 'address', 'ribbon', 'timezone', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug']}
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
{tabSelected === 'products' && (
|
|
75
|
+
<FavoriteList
|
|
76
|
+
favoriteURL='favorite_products'
|
|
77
|
+
originalURL='products'
|
|
78
|
+
onNavigationRedirect={onRedirect}
|
|
79
|
+
isProduct
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
82
|
+
{tabSelected === 'orders' && (
|
|
83
|
+
<FavoriteList
|
|
84
|
+
onNavigationRedirect={onRedirect}
|
|
85
|
+
favoriteURL='favorite_orders'
|
|
86
|
+
originalURL='orders'
|
|
87
|
+
isOrder
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
</Container>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const TabContainer = styled.View`
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
border-bottom-color: ${(props: any) => props.theme.colors.border};
|
|
6
|
+
border-bottom-width: 1px;
|
|
7
|
+
margin-bottom: 25px;
|
|
8
|
+
`
|
|
9
|
+
|
|
10
|
+
export const Tab = styled.TouchableOpacity`
|
|
11
|
+
margin-right: 32px;
|
|
12
|
+
${(props: any) => props.active && css`
|
|
13
|
+
border-bottom-color: ${(props: any) => props.theme.colors.textNormal};
|
|
14
|
+
border-bottom-width: 1px;
|
|
15
|
+
`}
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
export const Container = styled.View`
|
|
19
|
+
padding-horizontal: 40px;
|
|
20
|
+
padding-bottom: 20px;
|
|
21
|
+
padding-top: 30px;
|
|
22
|
+
`
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
4
|
+
import { FavoriteParams } from '../../types';
|
|
5
|
+
import { SingleOrderCard } from '../SingleOrderCard';
|
|
6
|
+
import {
|
|
7
|
+
FavoriteList as FavoriteListController,
|
|
8
|
+
useOrder,
|
|
9
|
+
useLanguage
|
|
10
|
+
} from 'ordering-components/native';
|
|
11
|
+
import { useTheme } from 'styled-components/native';
|
|
12
|
+
import { _setStoreData } from '../../providers/StoreUtil';
|
|
13
|
+
import { Container, WrappButton } from './styles'
|
|
14
|
+
import { OButton } from '../shared';
|
|
15
|
+
import { BusinessController } from '../BusinessController';
|
|
16
|
+
import { SingleProductCard } from '../SingleProductCard';
|
|
17
|
+
import moment from 'moment';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const FavoriteListUI = (props: FavoriteParams) => {
|
|
21
|
+
const {
|
|
22
|
+
favoriteList,
|
|
23
|
+
handleUpdateFavoriteList,
|
|
24
|
+
pagination,
|
|
25
|
+
getFavoriteList,
|
|
26
|
+
navigation,
|
|
27
|
+
onNavigationRedirect,
|
|
28
|
+
reorderState,
|
|
29
|
+
handleReorder,
|
|
30
|
+
isBusiness,
|
|
31
|
+
isOrder,
|
|
32
|
+
isProduct
|
|
33
|
+
} = props
|
|
34
|
+
|
|
35
|
+
const theme = useTheme();
|
|
36
|
+
const [, t] = useLanguage()
|
|
37
|
+
const [orderState] = useOrder();
|
|
38
|
+
const [{ carts }] = useOrder()
|
|
39
|
+
|
|
40
|
+
const pastOrders = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
|
|
41
|
+
|
|
42
|
+
const getOrderStatus = (s: any) => {
|
|
43
|
+
const status = parseInt(s)
|
|
44
|
+
const orderStatus = [
|
|
45
|
+
{ key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending') },
|
|
46
|
+
{ key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed') },
|
|
47
|
+
{ key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected') },
|
|
48
|
+
{ key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business') },
|
|
49
|
+
{ key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed') },
|
|
50
|
+
{ key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business') },
|
|
51
|
+
{ key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver') },
|
|
52
|
+
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business') },
|
|
53
|
+
{ key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver') },
|
|
54
|
+
{ key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver') },
|
|
55
|
+
{ key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver') },
|
|
56
|
+
{ key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver') },
|
|
57
|
+
{ key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver') },
|
|
58
|
+
{ key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder') },
|
|
59
|
+
{ key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready') },
|
|
60
|
+
{ key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer') },
|
|
61
|
+
{ key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer') },
|
|
62
|
+
{ key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer') },
|
|
63
|
+
{ key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business') },
|
|
64
|
+
{ key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer') },
|
|
65
|
+
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business') },
|
|
66
|
+
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business') },
|
|
67
|
+
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver') },
|
|
68
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way') }
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
72
|
+
|
|
73
|
+
return objectStatus && objectStatus
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const onProductClick = (product: any) => {
|
|
77
|
+
const categoryId = product?.category?.id
|
|
78
|
+
const businessId = product?.category?.business?.id
|
|
79
|
+
if (!categoryId || !businessId) return
|
|
80
|
+
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
81
|
+
productId: product?.id,
|
|
82
|
+
categoryId: categoryId,
|
|
83
|
+
businessId: businessId
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const _businessId = 'businessId:' + reorderState?.result?.business_id
|
|
89
|
+
if (reorderState?.error) {
|
|
90
|
+
if (reorderState?.result?.business_id) {
|
|
91
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
92
|
+
onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
|
|
96
|
+
const cartProducts = carts?.[_businessId]?.products
|
|
97
|
+
const available = cartProducts.every((product: any) => product.valid === true)
|
|
98
|
+
const orderProducts = favoriteList?.favorites.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
|
|
99
|
+
|
|
100
|
+
if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
|
|
101
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
102
|
+
} else {
|
|
103
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
104
|
+
cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
|
|
105
|
+
onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, [reorderState])
|
|
109
|
+
|
|
110
|
+
const handleBusinessClick = (business: any) => {
|
|
111
|
+
onNavigationRedirect && onNavigationRedirect('Business', {
|
|
112
|
+
store: business.slug,
|
|
113
|
+
header: business.header,
|
|
114
|
+
logo: business.logo,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const BusinessSkeleton = () => {
|
|
119
|
+
return (
|
|
120
|
+
<Placeholder
|
|
121
|
+
Animation={Fade}
|
|
122
|
+
style={{ marginBottom: 20 }}>
|
|
123
|
+
<View style={{ width: '100%' }}>
|
|
124
|
+
<PlaceholderLine
|
|
125
|
+
height={200}
|
|
126
|
+
style={{ marginBottom: 20, borderRadius: 25 }}
|
|
127
|
+
/>
|
|
128
|
+
<View style={{ paddingHorizontal: 10 }}>
|
|
129
|
+
<View
|
|
130
|
+
style={{
|
|
131
|
+
flexDirection: 'row',
|
|
132
|
+
justifyContent: 'space-between',
|
|
133
|
+
}}>
|
|
134
|
+
<PlaceholderLine
|
|
135
|
+
height={25}
|
|
136
|
+
width={40}
|
|
137
|
+
style={{ marginBottom: 10 }}
|
|
138
|
+
/>
|
|
139
|
+
<PlaceholderLine
|
|
140
|
+
height={25}
|
|
141
|
+
width={20}
|
|
142
|
+
style={{ marginBottom: 10 }}
|
|
143
|
+
/>
|
|
144
|
+
</View>
|
|
145
|
+
<PlaceholderLine
|
|
146
|
+
height={20}
|
|
147
|
+
width={30}
|
|
148
|
+
style={{ marginBottom: 10 }}
|
|
149
|
+
/>
|
|
150
|
+
<PlaceholderLine
|
|
151
|
+
height={20}
|
|
152
|
+
width={80}
|
|
153
|
+
style={{ marginBottom: 10 }}
|
|
154
|
+
/>
|
|
155
|
+
</View>
|
|
156
|
+
</View>
|
|
157
|
+
</Placeholder>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const ProductSkeleton = () => {
|
|
162
|
+
return (
|
|
163
|
+
<Placeholder style={{ padding: 5 }} Animation={Fade}>
|
|
164
|
+
<View style={{ flexDirection: 'row' }}>
|
|
165
|
+
<PlaceholderLine
|
|
166
|
+
width={24}
|
|
167
|
+
height={70}
|
|
168
|
+
style={{ marginRight: 10, marginBottom: 10 }}
|
|
169
|
+
/>
|
|
170
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
171
|
+
<PlaceholderLine width={60} style={{ marginBottom: 25 }} />
|
|
172
|
+
<PlaceholderLine width={20} />
|
|
173
|
+
</Placeholder>
|
|
174
|
+
</View>
|
|
175
|
+
</Placeholder>
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const OrderSkeleton = () => {
|
|
180
|
+
return (
|
|
181
|
+
<Placeholder style={{ padding: 5 }} Animation={Fade}>
|
|
182
|
+
<View style={{ flexDirection: 'row' }}>
|
|
183
|
+
<PlaceholderLine
|
|
184
|
+
width={24}
|
|
185
|
+
height={70}
|
|
186
|
+
style={{ marginRight: 10, marginBottom: 10 }}
|
|
187
|
+
/>
|
|
188
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
189
|
+
<PlaceholderLine width={60} style={{ marginBottom: 25 }} />
|
|
190
|
+
<PlaceholderLine width={20} />
|
|
191
|
+
</Placeholder>
|
|
192
|
+
</View>
|
|
193
|
+
</Placeholder>
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<Container>
|
|
199
|
+
{isBusiness && (
|
|
200
|
+
<>
|
|
201
|
+
{favoriteList?.favorites?.length > 0 && (
|
|
202
|
+
favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((business: any, i:number) => (
|
|
203
|
+
<BusinessController
|
|
204
|
+
key={`${business.id}_` + i}
|
|
205
|
+
business={business}
|
|
206
|
+
isBusinessOpen={business.open}
|
|
207
|
+
handleCustomClick={handleBusinessClick}
|
|
208
|
+
orderType={orderState?.options?.type}
|
|
209
|
+
navigation={navigation}
|
|
210
|
+
businessHeader={business?.header}
|
|
211
|
+
businessFeatured={business?.featured}
|
|
212
|
+
businessLogo={business?.logo}
|
|
213
|
+
businessReviews={business?.reviews}
|
|
214
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
215
|
+
businessDeliveryTime={business?.delivery_time}
|
|
216
|
+
businessPickupTime={business?.pickup_time}
|
|
217
|
+
businessDistance={business?.distance}
|
|
218
|
+
handleUpdateBusinessList={handleUpdateFavoriteList}
|
|
219
|
+
/>
|
|
220
|
+
))
|
|
221
|
+
)}
|
|
222
|
+
{favoriteList?.loading && (
|
|
223
|
+
[...Array(5).keys()].map(i => (
|
|
224
|
+
<BusinessSkeleton key={i} />
|
|
225
|
+
))
|
|
226
|
+
)}
|
|
227
|
+
</>
|
|
228
|
+
)}
|
|
229
|
+
|
|
230
|
+
{isOrder && (
|
|
231
|
+
<>
|
|
232
|
+
{favoriteList?.favorites?.length > 0 && (
|
|
233
|
+
favoriteList.favorites?.sort((a: any, b:any) => moment(a?.delivery_datetime_utc).valueOf() - moment(b?.delivery_datetime_utc).valueOf())
|
|
234
|
+
.map((order: any, i: number) => (
|
|
235
|
+
<SingleOrderCard
|
|
236
|
+
key={`${order?.id}_${i}`}
|
|
237
|
+
order={order}
|
|
238
|
+
getOrderStatus={getOrderStatus}
|
|
239
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
240
|
+
pastOrders={pastOrders.includes(order?.status)}
|
|
241
|
+
handleUpdateOrderList={handleUpdateFavoriteList}
|
|
242
|
+
handleUpdateFavoriteList={handleUpdateFavoriteList}
|
|
243
|
+
handleReorder={handleReorder}
|
|
244
|
+
reorderLoading={reorderState?.loading}
|
|
245
|
+
/>
|
|
246
|
+
))
|
|
247
|
+
)}
|
|
248
|
+
{favoriteList?.loading && (
|
|
249
|
+
[...Array(5).keys()].map(i => (
|
|
250
|
+
<OrderSkeleton key={i} />
|
|
251
|
+
))
|
|
252
|
+
)}
|
|
253
|
+
</>
|
|
254
|
+
)}
|
|
255
|
+
|
|
256
|
+
{isProduct && (
|
|
257
|
+
<>
|
|
258
|
+
{favoriteList?.favorites?.length > 0 && (
|
|
259
|
+
favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((product: any, i: number) => (
|
|
260
|
+
<SingleProductCard
|
|
261
|
+
key={`${product?.id}_${i}`}
|
|
262
|
+
isSoldOut={product?.inventoried && !product?.quantity}
|
|
263
|
+
product={product}
|
|
264
|
+
onProductClick={onProductClick}
|
|
265
|
+
handleUpdateProducts={handleUpdateFavoriteList}
|
|
266
|
+
/>
|
|
267
|
+
))
|
|
268
|
+
)}
|
|
269
|
+
{favoriteList?.loading && (
|
|
270
|
+
[...Array(5).keys()].map(i => (
|
|
271
|
+
<ProductSkeleton key={i} />
|
|
272
|
+
))
|
|
273
|
+
)}
|
|
274
|
+
</>
|
|
275
|
+
)}
|
|
276
|
+
|
|
277
|
+
{!favoriteList?.loading && pagination.totalPages && pagination.currentPage < pagination.totalPages && (
|
|
278
|
+
<WrappButton>
|
|
279
|
+
<OButton
|
|
280
|
+
onClick={() => getFavoriteList(pagination?.currentPage + 1)}
|
|
281
|
+
text={t('LOAD_MORE_ITEMS', 'Load more items')}
|
|
282
|
+
imgRightSrc={null}
|
|
283
|
+
textStyle={{ color: theme.colors.white }}
|
|
284
|
+
style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
|
|
285
|
+
/>
|
|
286
|
+
</WrappButton>
|
|
287
|
+
)}
|
|
288
|
+
</Container>
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export const FavoriteList = (props: any) => {
|
|
293
|
+
const favoriteBusinessesProps = {
|
|
294
|
+
...props,
|
|
295
|
+
UIComponent: FavoriteListUI
|
|
296
|
+
}
|
|
297
|
+
return <FavoriteListController {...favoriteBusinessesProps} />
|
|
298
|
+
}
|