ordering-ui-react-native 0.12.57 → 0.12.58

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.
Files changed (175) hide show
  1. package/package.json +1 -1
  2. package/themes/single-business/src/components/Cart/index.tsx +91 -15
  3. package/themes/single-business/src/components/Cart/styles.tsx +39 -0
  4. package/themes/single-business/src/components/CartContent/index.tsx +56 -52
  5. package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
  6. package/themes/franchises/index.tsx +0 -111
  7. package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
  8. package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
  9. package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
  10. package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
  11. package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
  12. package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
  13. package/themes/franchises/src/components/AddressList/index.tsx +0 -338
  14. package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
  15. package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
  16. package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
  17. package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
  18. package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
  19. package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
  20. package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
  21. package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
  22. package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
  23. package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
  24. package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
  25. package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
  26. package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
  27. package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
  28. package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
  29. package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
  30. package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
  31. package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
  32. package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
  33. package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
  34. package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
  35. package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
  36. package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
  37. package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
  38. package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
  39. package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
  40. package/themes/franchises/src/components/Cart/index.tsx +0 -332
  41. package/themes/franchises/src/components/Cart/styles.tsx +0 -28
  42. package/themes/franchises/src/components/CartContent/index.tsx +0 -60
  43. package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
  44. package/themes/franchises/src/components/Checkout/index.tsx +0 -664
  45. package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
  46. package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
  47. package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
  48. package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
  49. package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
  50. package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
  51. package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
  52. package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
  53. package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
  54. package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
  55. package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
  56. package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
  57. package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
  58. package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
  59. package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
  60. package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
  61. package/themes/franchises/src/components/Help/index.tsx +0 -56
  62. package/themes/franchises/src/components/Help/styles.tsx +0 -11
  63. package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
  64. package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
  65. package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
  66. package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
  67. package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
  68. package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
  69. package/themes/franchises/src/components/Home/index.tsx +0 -102
  70. package/themes/franchises/src/components/Home/styles.tsx +0 -18
  71. package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
  72. package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
  73. package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
  74. package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
  75. package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
  76. package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
  77. package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
  78. package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
  79. package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
  80. package/themes/franchises/src/components/Messages/index.tsx +0 -359
  81. package/themes/franchises/src/components/Messages/styles.tsx +0 -20
  82. package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
  83. package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
  84. package/themes/franchises/src/components/NavBar/index.tsx +0 -129
  85. package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
  86. package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
  87. package/themes/franchises/src/components/Notifications/index.tsx +0 -120
  88. package/themes/franchises/src/components/Notifications/styles.ts +0 -21
  89. package/themes/franchises/src/components/OrderDetails/index.tsx +0 -828
  90. package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
  91. package/themes/franchises/src/components/OrderSummary/index.tsx +0 -266
  92. package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
  93. package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
  94. package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
  95. package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
  96. package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
  97. package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
  98. package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
  99. package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
  100. package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
  101. package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
  102. package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
  103. package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
  104. package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
  105. package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
  106. package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
  107. package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
  108. package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
  109. package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
  110. package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
  111. package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
  112. package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
  113. package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
  114. package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
  115. package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
  116. package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
  117. package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
  118. package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
  119. package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
  120. package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
  121. package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
  122. package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
  123. package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
  124. package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
  125. package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
  126. package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
  127. package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
  128. package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
  129. package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
  130. package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
  131. package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
  132. package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
  133. package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
  134. package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
  135. package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
  136. package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
  137. package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
  138. package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
  139. package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
  140. package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
  141. package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
  142. package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
  143. package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
  144. package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
  145. package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
  146. package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
  147. package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
  148. package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
  149. package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
  150. package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
  151. package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
  152. package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
  153. package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
  154. package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
  155. package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
  156. package/themes/franchises/src/components/shared/OButton.tsx +0 -132
  157. package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
  158. package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
  159. package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
  160. package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
  161. package/themes/franchises/src/components/shared/OInput.tsx +0 -113
  162. package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
  163. package/themes/franchises/src/components/shared/OModal.tsx +0 -172
  164. package/themes/franchises/src/components/shared/OText.tsx +0 -52
  165. package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
  166. package/themes/franchises/src/components/shared/OToast.tsx +0 -93
  167. package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
  168. package/themes/franchises/src/components/shared/index.tsx +0 -29
  169. package/themes/franchises/src/config/constants.tsx +0 -57
  170. package/themes/franchises/src/layouts/Container.tsx +0 -23
  171. package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
  172. package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
  173. package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
  174. package/themes/franchises/src/types/index.tsx +0 -445
  175. package/themes/franchises/src/utils/index.tsx +0 -222
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.57",
3
+ "version": "0.12.58",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -16,26 +16,32 @@ import {
16
16
  OSCoupon,
17
17
  OSTotal,
18
18
  Title,
19
- LineDivider
19
+ LineDivider,
20
+ BIHeader,
21
+ BIInfo,
22
+ BIContentInfo,
23
+ BITotal
20
24
  } from './styles';
21
25
 
22
26
  import { ProductItemAccordion } from '../ProductItemAccordion';
23
27
  import { CouponControl } from '../CouponControl';
24
28
 
25
- import { OButton, OModal, OText } from '../shared';
29
+ import { OButton, OIcon, OModal, OText } from '../shared';
26
30
  import { ProductForm } from '../ProductForm';
27
31
  import { UpsellingProducts } from '../UpsellingProducts';
28
- import { verifyDecimals } from '../../utils';
32
+ import { convertHoursToMinutes, verifyDecimals } from '../../utils';
29
33
  import { Container } from '../../layouts/Container';
30
34
  import { NotFoundSource } from '../NotFoundSource'
31
35
  import { OSRow } from '../OrderSummary/styles';
32
36
  import AntIcon from 'react-native-vector-icons/AntDesign'
37
+ import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
33
38
  import { TaxInformation } from '../TaxInformation';
34
39
  import { TouchableOpacity } from 'react-native';
35
40
  const CartUI = (props: any) => {
36
41
  const {
37
42
  cart,
38
43
  clearCart,
44
+ isCartList,
39
45
  changeQuantity,
40
46
  getProductMax,
41
47
  offsetDisabled,
@@ -62,6 +68,8 @@ const CartUI = (props: any) => {
62
68
 
63
69
  const isCartPending = cart?.status === 2
64
70
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
71
+ const isClosed = !cart?.valid_schedule
72
+ const isProducts = cart?.products?.length
65
73
 
66
74
  const handleDeleteClick = (product: any) => {
67
75
  removeProduct(product, cart)
@@ -110,22 +118,91 @@ const CartUI = (props: any) => {
110
118
  }
111
119
  }
112
120
 
121
+ const CartHeader = () => {
122
+ return (
123
+ <BIHeader isClosed={isClosed}>
124
+ <BIInfo>
125
+ {cart?.business?.logo && (
126
+ <View
127
+ style={{
128
+ height: 72,
129
+ width: 72,
130
+ borderWidth: 1,
131
+ borderColor: theme.colors.border,
132
+ borderRadius: 8
133
+ }}
134
+ >
135
+ <OIcon
136
+ url={cart?.business?.logo}
137
+ width={70}
138
+ height={70}
139
+ style={{ borderRadius: 16 }}
140
+ />
141
+ </View>
142
+ )}
143
+ <BIContentInfo>
144
+ <OText>{cart?.business?.name}</OText>
145
+ {orderState?.options?.type === 1 ? (
146
+ <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
147
+ <MaterialCommunityIcon
148
+ name='clock-outline'
149
+ size={20}
150
+ />
151
+ <OText size={12}>{convertHoursToMinutes(cart?.business?.delivery_time)}</OText>
152
+ </View>
153
+ ) : (
154
+ <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
155
+ <MaterialCommunityIcon
156
+ name='clock-outline'
157
+ size={20}
158
+ />
159
+ <OText size={12}>{convertHoursToMinutes(cart?.business?.pickup_time)}</OText>
160
+ </View>
161
+ )}
162
+ </BIContentInfo>
163
+ </BIInfo>
164
+
165
+ {!isClosed && !!isProducts && cart?.valid_products && cart?.total > 0 && (
166
+ <BITotal>
167
+ <OText size={12}>{t('CART_TOTAL', 'Total')}</OText>
168
+ <OText size={12} color='#000'>{parsePrice(cart?.total)}</OText>
169
+ </BITotal>
170
+ )}
171
+
172
+ {isClosed && (
173
+ <BITotal>
174
+ <OText>{t('CLOSED', 'Closed')}</OText>
175
+ </BITotal>
176
+ )}
177
+
178
+ {!isClosed && !isProducts && (
179
+ <BITotal>
180
+ <OText>{t('NO_PRODUCTS', 'No products')}</OText>
181
+ </BITotal>
182
+ )}
183
+ </BIHeader>
184
+ )
185
+ }
186
+
113
187
  return (
114
188
  cart?.products?.length > 0 ? (
115
189
  <ScrollView
116
190
  showsVerticalScrollIndicator={false}
117
191
  showsHorizontalScrollIndicator={false}
118
- style={{ height, backgroundColor: theme.colors.backgroundPage }}
192
+ style={{ height: isCartList ? 'auto' : height, backgroundColor: theme.colors.backgroundPage }}
119
193
  >
120
- <Container>
121
- <Title>
122
- <OText
123
- size={20}
124
- weight='bold'
125
- >
126
- {t('YOUR_CART', 'Your cart')}
127
- </OText>
128
- </Title>
194
+ <Container noPadding={isCartList}>
195
+ {!isCartList ? (
196
+ <Title>
197
+ <OText
198
+ size={20}
199
+ >
200
+ {t('YOUR_CART', 'Your cart')}
201
+ </OText>
202
+ </Title>
203
+ ) : (
204
+ <CartHeader />
205
+ )}
129
206
 
130
207
  {cart?.products?.length > 0 && (
131
208
  <View>
@@ -247,7 +324,7 @@ const CartUI = (props: any) => {
247
324
  <>
248
325
  <LineDivider />
249
326
 
250
- <Container>
327
+ <Container noPadding={isCartList}>
251
328
  <View style={{ padding: 0, }}>
252
329
  <ScrollView
253
330
  showsVerticalScrollIndicator={false}
@@ -323,7 +400,6 @@ const CartUI = (props: any) => {
323
400
  <Title>
324
401
  <OText
325
402
  size={20}
326
- weight='bold'
327
403
  >
328
404
  {t('YOUR_CART', 'Your cart')}
329
405
  </OText>
@@ -61,3 +61,42 @@ export const OSCoupon = styled.View`
61
61
  width: 100%;
62
62
  padding: 5px 0px;
63
63
  `
64
+
65
+ export const BIHeader = styled.View`
66
+ flex-direction: row;
67
+ align-items: center;
68
+ justify-content: space-between;
69
+ border-bottom-width: 1px;
70
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
71
+ padding-bottom: 10px;
72
+
73
+ ${(props: any) => props.isClosed && css`
74
+ background-color: rgba(0, 0, 0, 0.1);
75
+ `}
76
+ `
77
+
78
+ export const BIInfo = styled.View`
79
+ display: flex;
80
+ flex-direction: row;
81
+ align-items: center;
82
+ width: 55%;
83
+ `
84
+
85
+ export const BIContent = styled.View`
86
+ `
87
+
88
+ export const BIContentInfo = styled.View`
89
+ display: flex;
90
+ flex-direction: column;
91
+ justify-content: flex-end;
92
+ text-transform: capitalize;
93
+ margin-left: 10px;
94
+ max-width: 65%;
95
+ `
96
+
97
+ export const BITotal = styled.View`
98
+ width: 25%;
99
+ display: flex;
100
+ flex-direction: column;
101
+ align-items: flex-end;
102
+ `
@@ -1,60 +1,64 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { useLanguage, useOrder } from 'ordering-components/native';
1
+ import React, { useState } from 'react';
2
+ import { useWindowDimensions, View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
- import { CCContainer, CCNotCarts, CCList } from './styles';
4
+ import { useLanguage } from 'ordering-components/native';
5
+ import Spinner from 'react-native-loading-spinner-overlay';
5
6
 
7
+ import { Title } from './styles';
6
8
  import { Cart } from '../Cart';
7
- import { OIcon, OText } from '../shared';
8
- import Spinner from 'react-native-loading-spinner-overlay';
9
- import { View } from 'react-native';
9
+ import { NotFoundSource } from '../NotFoundSource';
10
+ import { OText } from '../shared';
10
11
 
11
12
  export const CartContent = (props: any) => {
12
- const {
13
- carts,
14
- isOrderStateCarts
15
- } = props
13
+ const { carts } = props
16
14
 
17
- const theme = useTheme();
18
- const [, t] = useLanguage()
19
- const [isCartsLoading, setIsCartsLoading] = useState(false)
15
+ const { height } = useWindowDimensions()
16
+ const theme = useTheme();
17
+ const [, t] = useLanguage()
18
+ const [isCartsLoading, setIsCartsLoading] = useState(false)
20
19
 
21
- return (
22
- <CCContainer>
23
- {isOrderStateCarts && carts?.length > 0 && (
24
- <>
25
- <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
26
- {carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
27
- </OText>
28
- {carts.map((cart: any) => (
29
- <CCList key={cart.uuid} style={{ overflow: 'visible' }}>
30
- {cart.products.length > 0 && (
31
- <>
32
- <Cart
33
- cart={cart}
34
- onNavigationRedirect={props.onNavigationRedirect}
35
- isCartsLoading={isCartsLoading}
36
- setIsCartsLoading={setIsCartsLoading}
37
- />
38
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
39
- </>
40
- )}
41
- </CCList>
42
- ))}
43
- </>
44
- )}
45
- {(!carts || carts?.length === 0) && (
46
- <CCNotCarts>
47
- {/* <OIcon
48
- url={props.icon}
49
- width={200}
50
- height={122}
51
- /> */}
52
- <OText size={24} style={{ textAlign: 'center' }}>
53
- {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
54
- </OText>
55
- </CCNotCarts>
56
- )}
57
- <Spinner visible={isCartsLoading} />
58
- </CCContainer>
59
- )
20
+ return (
21
+ carts?.length > 0 ? (
22
+ <>
23
+ <Title>
24
+ <OText size={20} style={{ marginTop: 20 }}>
25
+ {carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
26
+ </OText>
27
+ </Title>
28
+ {carts.map((cart: any, i: number) => (
29
+ <View key={cart.uuid} style={{ overflow: 'visible' }}>
30
+ {cart.products.length > 0 && (
31
+ <>
32
+ <Cart
33
+ cart={cart}
34
+ isCartList
35
+ onNavigationRedirect={props.onNavigationRedirect}
36
+ isCartsLoading={isCartsLoading}
37
+ setIsCartsLoading={setIsCartsLoading}
38
+ />
39
+ {!(i === (carts.length - 1)) && (
40
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginVertical: 20 }} />
41
+ )}
42
+ </>
43
+ )}
44
+ </View>
45
+ ))}
46
+ <Spinner visible={isCartsLoading} />
47
+ </>
48
+ ) : (
49
+ <>
50
+ <Title>
51
+ <OText size={20}>
52
+ {t('MY_CARTS', 'My Carts')}
53
+ </OText>
54
+ </Title>
55
+ <View style={{ height: height * 0.7, justifyContent: 'center' }}>
56
+ <NotFoundSource
57
+ content={t('NO_CARTS_FOUND', 'Sorry, no carts found')}
58
+ image={theme.images.general.notFound}
59
+ />
60
+ </View>
61
+ </>
62
+ )
63
+ )
60
64
  }
@@ -1,19 +1,5 @@
1
1
  import styled from 'styled-components/native';
2
2
 
3
- export const CCContainer = styled.View`
4
- padding: 20px 40px;
5
- `
6
-
7
- export const CCNotCarts = styled.View`
8
- height: 300px;
9
- display: flex;
10
- flex-direction: column;
11
- justify-content: center;
12
- align-items: center;
13
- width: 80%;
14
- margin: auto;
15
- `
16
-
17
- export const CCList = styled.ScrollView`
18
- padding: 10px 0px;
3
+ export const Title = styled.View`
4
+ margin: 20px 0;
19
5
  `
@@ -1,111 +0,0 @@
1
- import { AddressForm } from './src/components/AddressForm';
2
- import { AddressDetails } from './src/components/AddressDetails';
3
- import { Home } from './src/components/Home';
4
- import { LoginForm } from './src/components/LoginForm';
5
- import { SignupForm } from './src/components/SignupForm';
6
- import { ActiveOrders } from './src/components/ActiveOrders';
7
- import { AddressList } from './src/components/AddressList';
8
- import { AppleLogin } from './src/components/AppleLogin';
9
- import { BusinessesListing } from './src/components/BusinessesListing';
10
- import { BusinessProductsListing } from './src/components/BusinessProductsListing';
11
- import { CartContent } from './src/components/CartContent';
12
- import { Checkout } from './src/components/Checkout';
13
- import { ForgotPasswordForm } from './src/components/ForgotPasswordForm';
14
- import { MomentOption } from './src/components/MomentOption';
15
- import { OrdersOption } from './src/components/OrdersOption';
16
- import { OrderDetails } from './src/components/OrderDetails';
17
- import { UserProfileForm } from './src/components/UserProfileForm';
18
- import { ReviewOrder } from './src/components/ReviewOrder';
19
- import { UserProfile } from './src/components/UserProfile';
20
- import { NotFoundSource } from './src/components/NotFoundSource';
21
- import { Help } from './src/components/Help';
22
- import { HelpOrder } from './src/components/HelpOrder';
23
- import { HelpGuide } from './src/components/HelpGuide';
24
- import { HelpAccountAndPayment } from './src/components/HelpAccountAndPayment';
25
- import { OrderTypeSelector } from './src/components/OrderTypeSelector';
26
- import Notifications from './src/components/Notifications';
27
- import { ReviewProduct } from './src/components/ReviewProduct';
28
- import { ReviewDriver } from './src/components/ReviewDriver';
29
-
30
- import { Toast } from './src/components/shared/OToast';
31
- import {
32
- OText,
33
- OButton,
34
- OInput,
35
- ODropDown,
36
- OIcon,
37
- OIconText,
38
- OIconButton,
39
- OTextarea,
40
- OToggle,
41
- OKeyButton,
42
- OAlert,
43
- OModal,
44
- OBottomPopup,
45
- } from './src/components/shared';
46
-
47
- import { Container } from './src/layouts/Container';
48
- import { SafeAreaContainer } from './src/layouts/SafeAreaContainer';
49
- import {
50
- _retrieveStoreData,
51
- _setStoreData,
52
- _removeStoreData,
53
- _clearStoreData
54
- } from './src/providers/StoreUtil';
55
-
56
- export {
57
- AddressForm,
58
- AddressDetails,
59
- Home as HomeView,
60
- SignupForm,
61
- LoginForm,
62
- ActiveOrders,
63
- AddressList,
64
- AppleLogin,
65
- BusinessesListing,
66
- BusinessProductsListing,
67
- CartContent,
68
- Checkout,
69
- ForgotPasswordForm,
70
- MomentOption,
71
- OrdersOption,
72
- OrderDetails,
73
- UserProfileForm,
74
- ReviewOrder,
75
- UserProfile,
76
- NotFoundSource,
77
- Help,
78
- HelpGuide,
79
- HelpOrder,
80
- HelpAccountAndPayment,
81
- OrderTypeSelector,
82
- Notifications,
83
- ReviewProduct,
84
- ReviewDriver,
85
-
86
- // OComponents
87
- Toast,
88
- OText,
89
- OButton,
90
- OInput,
91
- ODropDown,
92
- OIcon,
93
- OIconText,
94
- OIconButton,
95
- OTextarea,
96
- OToggle,
97
- OKeyButton,
98
- OAlert,
99
- OModal,
100
- OBottomPopup,
101
-
102
- // layout
103
- Container,
104
- SafeAreaContainer,
105
-
106
- // utils
107
- _retrieveStoreData,
108
- _setStoreData,
109
- _removeStoreData,
110
- _clearStoreData
111
- }
@@ -1,134 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
3
- import { OIcon, OIconButton, OText } from '../shared';
4
- import {
5
- ActiveOrdersContainer,
6
- Card,
7
- Information,
8
- Logo,
9
- OrderInformation,
10
- BusinessInformation,
11
- Price,
12
- } from './styles';
13
- import { View, StyleSheet } from 'react-native';
14
-
15
- import { ActiveOrdersParams } from '../../types';
16
- import moment from 'moment';
17
- import { useTheme } from 'styled-components/native';
18
- import { TouchableOpacity } from 'react-native-gesture-handler';
19
-
20
- export const ActiveOrders = (props: ActiveOrdersParams) => {
21
- const {
22
- onNavigationRedirect,
23
- orders,
24
- pagination,
25
- loadMoreOrders,
26
- getOrderStatus,
27
- isPreorders
28
- } = props;
29
-
30
- const theme = useTheme();
31
- const [{ configs }] = useConfig();
32
- const [, t] = useLanguage();
33
- const [{ parseDate, parsePrice, optimizeImage }] = useUtils();
34
-
35
- const formatDate = (date: string, option?: any) => {
36
- return option?.utc ? moment.utc(date).format('DD/MM/YY \u2022 h:m a') : moment(date).format('DD/MM/YY \u2022 h:m a');
37
- };
38
-
39
- const handleClickCard = (uuid: string) => {
40
- onNavigationRedirect &&
41
- onNavigationRedirect('OrderDetails', { orderId: uuid });
42
- };
43
-
44
- const handleLike = () => {
45
-
46
- }
47
-
48
- const Order = ({ order, index }: { order: any; index: number }) => (
49
- <React.Fragment>
50
- <Card
51
- isMiniCard={configs?.google_maps_api_key?.value}
52
- onPress={() => handleClickCard(order?.uuid)}
53
- activeOpacity={0.7}>
54
- <Information>
55
- {/* {!!order.business?.logo && (
56
- <Logo>
57
- <OIcon
58
- url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
59
- style={styles.logo}
60
- />
61
- </Logo>
62
- )} */}
63
- <OrderInformation>
64
- <BusinessInformation>
65
- <OText size={12} lineHeight={18} weight={600} numberOfLines={1} ellipsizeMode={'tail'}>
66
- {`${t('ORDER_NO', 'Order No')}.${order.id}`}
67
- </OText>
68
- <OText size={10} lineHeight={21} color={theme.colors.textSecondary}>
69
- {order?.delivery_datetime_utc
70
- ? formatDate(order?.delivery_datetime_utc)
71
- : formatDate(order?.delivery_datetime, { utc: false })}
72
- </OText>
73
- {/* {order?.status !== 0 && ( */}
74
- <OText
75
- color={theme.colors.primary}
76
- size={10}
77
- lineHeight={15}
78
- weight={400}
79
- numberOfLines={2}>
80
- {getOrderStatus(order.status)?.value}
81
- </OText>
82
- {/* )} */}
83
- </BusinessInformation>
84
- <Price>
85
- <OText size={12} lineHeight={18}>
86
- {parsePrice(order?.summary?.total || order?.total)}
87
- </OText>
88
- {!isPreorders &&
89
- <TouchableOpacity onPress={handleLike}>
90
- <OIcon src={theme.images.general.heart} color={theme.colors.red} width={16} />
91
- </TouchableOpacity>
92
- }
93
- </Price>
94
- </OrderInformation>
95
- </Information>
96
- </Card>
97
- </React.Fragment>
98
- );
99
-
100
- return (
101
- <>
102
- <ActiveOrdersContainer isMiniCards={configs?.google_maps_api_key?.value}>
103
- {orders.length > 0 &&
104
- orders.map((order: any, index: any) => (
105
- <Order key={order?.id || order?.uuid} order={order} index={index} />
106
- ))}
107
- </ActiveOrdersContainer>
108
- <View
109
- style={{
110
- height: 8,
111
- backgroundColor: theme.colors.backgroundGray100,
112
- marginHorizontal: -40,
113
- }}
114
- />
115
- </>
116
- );
117
- };
118
-
119
- const styles = StyleSheet.create({
120
- logo: {
121
- borderRadius: 7.6,
122
- width: 64,
123
- height: 64,
124
- },
125
- orderNumber: {
126
- flexDirection: 'row',
127
- marginVertical: 3,
128
- },
129
- loadOrders: {
130
- justifyContent: 'center',
131
- alignItems: 'center',
132
- minWidth: 230,
133
- },
134
- });
@@ -1,44 +0,0 @@
1
- import styled from 'styled-components/native'
2
-
3
- export const ActiveOrdersContainer = styled.View`
4
- margin-bottom: 20px;
5
- `
6
-
7
- export const Card = styled.TouchableOpacity`
8
- flex: 1;
9
- `
10
-
11
- export const Map = styled.View`
12
- flex: 1;
13
- height: 125px;
14
- margin-bottom: 22px
15
- `
16
-
17
- export const Information = styled.View`
18
- flex-direction: row;
19
- align-items: center;
20
- padding-vertical: 5px;
21
- margin-bottom: 12px;
22
- `
23
-
24
- export const Logo = styled.View`
25
- border-radius: 7.6px;
26
- box-shadow: 0 1px 2px #0000001A;
27
- `
28
-
29
- export const OrderInformation = styled.View`
30
- flex-direction: row;
31
- justify-content: space-between;
32
- flex: 1;
33
- `
34
-
35
- export const BusinessInformation = styled.View`
36
- flex-basis: 65%;
37
- `
38
-
39
- export const Price = styled.View`
40
- justify-content: flex-start;
41
- align-items: flex-end;
42
- margin-left: 10px;
43
- width: 30%;
44
- `