ordering-ui-react-native 0.15.25 → 0.15.26-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.
Files changed (159) hide show
  1. package/package.json +3 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessController/index.tsx +8 -2
  4. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +0 -1
  7. package/src/components/LanguageSelector/index.tsx +7 -2
  8. package/src/components/OrderDetails/index.tsx +2 -2
  9. package/src/components/PaymentOptions/index.tsx +9 -16
  10. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  11. package/src/components/SingleProductCard/index.tsx +16 -4
  12. package/src/components/StripeElementsForm/index.tsx +27 -48
  13. package/src/components/UserProfileForm/index.tsx +63 -6
  14. package/src/components/UserProfileForm/styles.tsx +8 -0
  15. package/src/components/VerifyPhone/styles.tsx +1 -2
  16. package/src/components/shared/OModal.tsx +1 -1
  17. package/src/config.json +0 -2
  18. package/src/hooks/useCountdownTimer.tsx +26 -0
  19. package/src/navigators/HomeNavigator.tsx +6 -0
  20. package/src/pages/BusinessProductsList.tsx +1 -0
  21. package/src/pages/BusinessesListing.tsx +1 -1
  22. package/src/pages/Checkout.tsx +1 -1
  23. package/src/pages/Sessions.tsx +22 -0
  24. package/src/types/index.tsx +5 -11
  25. package/src/utils/index.tsx +68 -1
  26. package/themes/business/index.tsx +2 -0
  27. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  28. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  29. package/themes/business/src/components/Chat/index.tsx +38 -86
  30. package/themes/business/src/components/Home/index.tsx +128 -55
  31. package/themes/business/src/components/Home/styles.tsx +8 -1
  32. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  33. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  34. package/themes/business/src/components/NewOrderNotification/index.tsx +61 -98
  35. package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
  36. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  37. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
  38. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
  39. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  40. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  41. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  42. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  43. package/themes/business/src/components/OrdersOption/index.tsx +54 -50
  44. package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
  45. package/themes/business/src/components/shared/OModal.tsx +1 -1
  46. package/themes/business/src/types/index.tsx +5 -1
  47. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  48. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  49. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  51. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  52. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  53. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  54. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  55. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  56. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  57. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  58. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  59. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  60. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  61. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  62. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  63. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  64. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  65. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  66. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  67. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  68. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  69. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  70. package/themes/kiosk/src/types/index.d.ts +2 -0
  71. package/themes/original/index.tsx +178 -1
  72. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  73. package/themes/original/src/components/AddressList/index.tsx +56 -18
  74. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  78. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +121 -7
  82. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  83. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  84. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  85. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  86. package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
  87. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  88. package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
  89. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  90. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  91. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  92. package/themes/original/src/components/BusinessesListing/index.tsx +51 -58
  93. package/themes/original/src/components/Cart/index.tsx +19 -15
  94. package/themes/original/src/components/CartContent/index.tsx +2 -2
  95. package/themes/original/src/components/Checkout/index.tsx +42 -27
  96. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  97. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  98. package/themes/original/src/components/Help/index.tsx +21 -4
  99. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  100. package/themes/original/src/components/Home/index.tsx +1 -1
  101. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  102. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  103. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  104. package/themes/original/src/components/LoginForm/index.tsx +389 -156
  105. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  106. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  107. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  108. package/themes/original/src/components/Messages/index.tsx +34 -25
  109. package/themes/original/src/components/Messages/styles.tsx +1 -3
  110. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  111. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  112. package/themes/original/src/components/OrderDetails/index.tsx +35 -28
  113. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  114. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  115. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  116. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  117. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  118. package/themes/original/src/components/OrdersOption/index.tsx +25 -33
  119. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  120. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  121. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  122. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  123. package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
  124. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  125. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  126. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  127. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  128. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  129. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  130. package/themes/original/src/components/Promotions/index.tsx +250 -0
  131. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  132. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  133. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  134. package/themes/original/src/components/Sessions/index.tsx +160 -0
  135. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  136. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  137. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  138. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  139. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  140. package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
  141. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  142. package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
  143. package/themes/original/src/components/UserProfile/index.tsx +62 -14
  144. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  145. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  146. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  147. package/themes/original/src/components/Wallets/index.tsx +76 -9
  148. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  149. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  150. package/themes/original/src/components/shared/OModal.tsx +1 -1
  151. package/themes/original/src/components/shared/index.tsx +2 -0
  152. package/themes/original/src/config/constants.tsx +6 -6
  153. package/themes/original/src/types/index.tsx +62 -5
  154. package/themes/original/src/utils/index.tsx +28 -2
  155. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  156. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  157. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  158. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  159. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -0,0 +1,874 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform } from 'react-native';
3
+ import { useLanguage, OrderListGroups, useConfig } from 'ordering-components/native';
4
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
5
+ import FontistoIcon from 'react-native-vector-icons/Fontisto'
6
+ import FeatherIcon from 'react-native-vector-icons/Feather';
7
+ import SelectDropdown from 'react-native-select-dropdown'
8
+ import { useTheme } from 'styled-components/native';
9
+
10
+ import {
11
+ FiltersTab,
12
+ TabsContainer,
13
+ Tag,
14
+ IconWrapper,
15
+ ModalContainer,
16
+ ModalTitle,
17
+ TabPressable,
18
+ OrderStatus,
19
+ SlaOption,
20
+ SearchModalContent,
21
+ SlaSettingModalContent,
22
+ DeliveryStatusWrapper,
23
+ VerticalLine,
24
+ LeftSide,
25
+ RightSide,
26
+ Sides
27
+ } from './styles';
28
+
29
+ import { OText, OButton, OModal, OIconButton, OInput, OIcon } from '../shared';
30
+ import { NotFoundSource } from '../NotFoundSource';
31
+ import { useOrderUtils, StatusBlock, Timer } from './utils'
32
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
33
+ import { NewOrderNotification } from '../NewOrderNotification';
34
+ import { PreviousOrders } from '../PreviousOrders';
35
+ import { OrdersOptionParams } from '../../types';
36
+ import { OrdersOptionCity } from '../OrdersOptionCity';
37
+ import { OrdersOptionBusiness } from '../OrdersOptionBusiness';
38
+ import { OrdersOptionDelivery } from '../OrdersOptionDelivery';
39
+ import { OrdersOptionPaymethod } from '../OrdersOptionPaymethod';
40
+ import { OrdersOptionDriver } from '../OrdersOptionDriver';
41
+ import { OrdersOptionDate } from '../OrdersOptionDate';
42
+ import { OrderDetailsBusiness } from '../OrderDetails/Business';
43
+
44
+ const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
45
+
46
+ const OrdersListManagerUI = (props: OrdersOptionParams) => {
47
+ const {
48
+ setCurrentFilters,
49
+ tabs,
50
+ currentTabSelected,
51
+ setCurrentTabSelected,
52
+ ordersGroup,
53
+ setOrdersGroup,
54
+ orderStatus,
55
+ loadOrders,
56
+ loadMoreOrders,
57
+ onNavigationRedirect,
58
+ onFiltered,
59
+ handleClickOrder,
60
+ isBusinessApp,
61
+ handleClickLogisticOrder,
62
+ logisticOrders,
63
+ loadLogisticOrders,
64
+ isLogisticActivated
65
+ } = props;
66
+
67
+ const theme = useTheme();
68
+ const [, t] = useLanguage();
69
+ const [{
70
+ calculateDate,
71
+ preorderTypeList,
72
+ defaultOrderTypes,
73
+ deliveryStatus,
74
+ defaultSearchList
75
+ }] = useOrderUtils()
76
+ const [orientationState] = useDeviceOrientation();
77
+ const [openSearchModal, setOpenSearchModal] = useState(false)
78
+ const [openSLASettingModal, setOpenSLASettingModal] = useState(false)
79
+ const [slaSettingTime, setSlaSettingTime] = useState(6000)
80
+ const [configState] = useConfig()
81
+ const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
82
+ const [search, setSearch] = useState(defaultSearchList)
83
+ const [selectedTabStatus, setSelectedTabStatus] = useState<any>([])
84
+
85
+ const HEIGHT_SCREEN = orientationState?.dimensions?.height
86
+ const IS_PORTRAIT = orientationState.orientation === PORTRAIT
87
+
88
+ const styles = StyleSheet.create({
89
+ header: {
90
+ marginBottom: isBusinessApp ? 10 : 20,
91
+ flexDirection: 'row',
92
+ justifyContent: 'space-between',
93
+ alignItems: 'center'
94
+ },
95
+ title: {
96
+ fontFamily: 'Poppins',
97
+ fontStyle: 'normal',
98
+ fontWeight: '600',
99
+ fontSize: 26,
100
+ color: theme.colors.textGray,
101
+ },
102
+ icons: {
103
+ flexDirection: 'row',
104
+ },
105
+ tab: {
106
+ fontFamily: 'Poppins',
107
+ fontStyle: 'normal',
108
+ fontSize: 14,
109
+ paddingBottom: 10,
110
+ marginBottom: -1,
111
+ zIndex: 100,
112
+ borderColor: theme.colors.textGray,
113
+ textTransform: 'capitalize'
114
+ },
115
+ icon: {
116
+ paddingBottom: 10,
117
+ zIndex: 100,
118
+ marginBottom: 5,
119
+ },
120
+ tagsContainer: {
121
+ marginBottom: 20,
122
+ height: '100%'
123
+ },
124
+ tag: {
125
+ fontFamily: 'Poppins',
126
+ fontStyle: 'normal',
127
+ fontWeight: 'normal',
128
+ fontSize: 14,
129
+ },
130
+ pressable: {
131
+ alignItems: 'center',
132
+ },
133
+ loadButton: {
134
+ borderRadius: 7.6,
135
+ height: 44,
136
+ marginRight: 10,
137
+ marginBottom: 10,
138
+ marginTop: 5,
139
+ },
140
+ loadButtonText: {
141
+ color: theme.colors.inputTextColor,
142
+ fontFamily: 'Poppins',
143
+ fontStyle: 'normal',
144
+ fontWeight: 'normal',
145
+ fontSize: 18,
146
+ },
147
+ inputStyle: {
148
+ width: '100%',
149
+ borderWidth: 1,
150
+ borderColor: '#DEE2E6',
151
+ borderRadius: 7.6,
152
+ marginBottom: 24
153
+ },
154
+ SLAwrapper: {
155
+ flexDirection: 'row',
156
+ marginBottom: 15
157
+ },
158
+ selectOption: {
159
+ alignItems: 'center',
160
+ justifyContent: 'space-between',
161
+ minHeight: 40,
162
+ width: '100%',
163
+ paddingHorizontal: 15,
164
+ backgroundColor: theme.colors.inputChat,
165
+ borderRadius: 7.6,
166
+ },
167
+ buttonTextStyle: {
168
+ textAlign: 'left',
169
+ marginHorizontal: 0,
170
+ fontSize: 16,
171
+ lineHeight: 24,
172
+ color: '#748194'
173
+ },
174
+ dropdownStyle: {
175
+ borderWidth: 1,
176
+ borderRadius: 8,
177
+ paddingTop: 5,
178
+ backgroundColor: '#fff',
179
+ borderColor: theme.colors.lightGray,
180
+ overflow: 'hidden',
181
+ minHeight: 155
182
+ },
183
+ rowStyle: {
184
+ display: 'flex',
185
+ borderBottomWidth: 0,
186
+ height: 36,
187
+ alignItems: 'center',
188
+ paddingHorizontal: 10
189
+ },
190
+ acceptButtonStyle: {
191
+ borderRadius: 7.6,
192
+ width: 130,
193
+ height: 42,
194
+ },
195
+ errorMessage: {
196
+ marginBottom: 10,
197
+ color: theme.colors.error,
198
+ }
199
+ });
200
+
201
+ const scrollRef = useRef() as React.MutableRefObject<ScrollView>;
202
+ const scrollListRef = useRef() as React.MutableRefObject<ScrollView>;
203
+ const scrollRefTab = useRef() as React.MutableRefObject<ScrollView>;
204
+
205
+ const [refreshing] = useState(false);
206
+ const [currentOrderSelected, setCurrentOrderSelected] = useState<any>(null)
207
+
208
+ const [tagsState, setTags] = useState<any>({ values: [] })
209
+
210
+ const tagsList = ordersGroup[currentTabSelected]?.defaultFilter ?? []
211
+ const currentOrdersGroup = ordersGroup[currentTabSelected]
212
+
213
+ const isEqual = (array1: any, array2: any) => {
214
+ return array1?.every((item: any) => array2.includes(item)) && array2?.every((item: any) => array1.includes(item))
215
+ }
216
+
217
+ const getOrderStatus = (key: number) => {
218
+ return orderStatus.find((status: any) => status?.key === key)?.text;
219
+ };
220
+
221
+ const applyFilters = () => {
222
+ setOrdersGroup({
223
+ ...ordersGroup,
224
+ [currentTabSelected]: {
225
+ ...ordersGroup[currentTabSelected],
226
+ orders: []
227
+ }
228
+ })
229
+ const dateRange = calculateDate(search.date.type, search.date.from, search.date.to)
230
+ onFiltered && onFiltered({ ...search, date: { ...dateRange } })
231
+ setOpenSearchModal(false)
232
+ }
233
+
234
+ const handleTagSelected = (tag: any) => {
235
+ const tags = tagsState?.values.includes(tag)
236
+ ? tagsState?.values.filter((t: any) => t !== tag)
237
+ : [...tagsState?.values, tag]
238
+
239
+ setCurrentFilters(!tags.length ? tagsList : tags)
240
+ setTags({ values: isEqual(tags, tagsList) ? [] : tags })
241
+
242
+ setOrdersGroup({
243
+ ...ordersGroup,
244
+ [currentTabSelected]: {
245
+ ...ordersGroup[currentTabSelected],
246
+ currentFilter: !tags.length ? tagsList : tags
247
+ }
248
+ })
249
+ }
250
+
251
+ const handleAllSelect = () => {
252
+ setCurrentFilters(tagsList)
253
+ setTags({ values: [] })
254
+ setOrdersGroup({
255
+ ...ordersGroup,
256
+ [currentTabSelected]: {
257
+ ...ordersGroup[currentTabSelected],
258
+ currentFilter: tagsList
259
+ }
260
+ })
261
+ }
262
+
263
+ const onClickSetting = () => {
264
+ setOpenSLASettingModal(true)
265
+ }
266
+
267
+ const handleClose = () => {
268
+ setOpenSearchModal(false)
269
+ setOpenSLASettingModal(false)
270
+ }
271
+
272
+ useEffect(() => {
273
+ setCurrentFilters(null)
274
+ onFiltered && onFiltered(null)
275
+ setSearch(defaultSearchList)
276
+ scrollRefTab.current?.scrollTo({ animated: true });
277
+ scrollListRef.current?.scrollTo({ animated: true });
278
+ scrollRef.current?.scrollTo({ y: 0, animated: true });
279
+ }, [currentTabSelected])
280
+
281
+ useEffect(() => {
282
+ setSelectedTabStatus(deliveryStatus)
283
+ }, [])
284
+
285
+ useEffect(() => {
286
+ if (currentOrdersGroup?.orders?.length > 0 && !tagsList.includes(currentOrderSelected?.status)) {
287
+ setCurrentOrderSelected(currentOrdersGroup?.orders[0])
288
+ }
289
+ }, [currentOrdersGroup?.orders, currentTabSelected])
290
+
291
+ return (
292
+ <>
293
+ <View style={styles.header}>
294
+ <OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
295
+ <IconWrapper>
296
+ <FeatherIcon
297
+ name='refresh-cw'
298
+ color={theme.colors.backgroundDark}
299
+ size={24}
300
+ onPress={() => {
301
+ currentTabSelected === 'logisticOrders'
302
+ ? loadLogisticOrders && loadLogisticOrders()
303
+ : loadOrders && loadOrders({ newFetch: true })
304
+ }}
305
+ style={{ marginRight: 20 }}
306
+ />
307
+ <FontistoIcon
308
+ name='search'
309
+ color={theme.colors.backgroundDark}
310
+ size={24}
311
+ onPress={() => setOpenSearchModal(true)}
312
+ />
313
+ </IconWrapper>
314
+ </View>
315
+ {configState?.configs?.order_deadlines_enabled?.value === '1' && (
316
+ <View style={styles.SLAwrapper}>
317
+ <View style={{ flex: 0.5 }}>
318
+ <OButton
319
+ text={t('SLA_SETTING', 'SLA’s Settings')}
320
+ textStyle={{ color: theme.colors.backArrow }}
321
+ imgRightSrc={null}
322
+ style={{
323
+ backgroundColor: theme.colors.inputChat,
324
+ borderRadius: 7.6,
325
+ zIndex: 10,
326
+ borderWidth: 0,
327
+ minHeight: 40
328
+ }}
329
+ onClick={onClickSetting}
330
+ />
331
+ </View>
332
+ <View style={{ width: 10, height: '100%' }} />
333
+ <View style={{ flex: 0.5, justifyContent: 'center' }}>
334
+ <SelectDropdown
335
+ defaultButtonText={t('SLA', 'SLA\'s')}
336
+ data={preorderTypeList}
337
+ onSelect={(selectedItem, index) => {
338
+ onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
339
+ }}
340
+ buttonTextAfterSelection={(selectedItem, index) => {
341
+ return selectedItem.name
342
+ }}
343
+ rowTextForSelection={(item, index) => {
344
+ return item.key
345
+ }}
346
+ buttonStyle={styles.selectOption}
347
+ buttonTextStyle={styles.buttonTextStyle}
348
+ renderDropdownIcon={isOpened => {
349
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
350
+ }}
351
+ dropdownStyle={styles.dropdownStyle}
352
+ dropdownOverlayColor='transparent'
353
+ rowStyle={styles.rowStyle}
354
+ renderCustomizedRowChild={(item, index) => {
355
+ return (
356
+ <SlaOption>
357
+ {index !== 0 && <OrderStatus timeState={item?.key} />}
358
+ <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
359
+ </SlaOption>
360
+ );
361
+ }}
362
+ />
363
+ </View>
364
+ </View>
365
+ )}
366
+
367
+ <Sides>
368
+ <LeftSide>
369
+ <FiltersTab>
370
+ <ScrollView
371
+ ref={scrollRefTab}
372
+ showsVerticalScrollIndicator={false}
373
+ showsHorizontalScrollIndicator={false}
374
+ horizontal
375
+ nestedScrollEnabled={true}
376
+ >
377
+ <TabsContainer>
378
+ {(isLogisticActivated && !isBusinessApp) && (
379
+ <Pressable
380
+ style={styles.pressable}
381
+ onPress={() => setCurrentTabSelected('logisticOrders')}>
382
+ <OIcon
383
+ src={theme.images?.general?.chronometer}
384
+ borderBottomWidth={currentTabSelected === 'logisticOrders' ? 1 : 0}
385
+ width={currentTabSelected === 'logisticOrders' ? 26 : 24}
386
+ height={currentTabSelected === 'logisticOrders' ? 26 : 24}
387
+ color={
388
+ currentTabSelected === 'logisticOrders'
389
+ ? theme.colors.textGray
390
+ : theme.colors.unselectText
391
+ }
392
+ style={styles.icon}
393
+ />
394
+ </Pressable>
395
+ )}
396
+ {tabs.map((tab: any) => (
397
+ <TabPressable
398
+ key={tab.key}
399
+ onPress={() => setCurrentTabSelected(tab?.title)}
400
+ isSelected={tab.title === currentTabSelected ? 1 : 0}
401
+ >
402
+ <OText
403
+ style={{
404
+ ...styles.tab,
405
+ fontSize: tab.title === currentTabSelected ? 16 : 14,
406
+ borderBottomWidth: Platform.OS === 'ios' && tab.title === currentTabSelected ? 1 : 0,
407
+ }}
408
+ color={
409
+ tab.title === currentTabSelected
410
+ ? theme.colors.textGra
411
+ : theme.colors.unselectText
412
+ }
413
+ weight={tab.title === currentTabSelected ? '600' : 'normal'}
414
+ >
415
+ {tab.text}
416
+ </OText>
417
+ </TabPressable>
418
+ ))}
419
+ </TabsContainer>
420
+ </ScrollView>
421
+ </FiltersTab>
422
+
423
+ {currentTabSelected !== 'logisticOrders' && (
424
+ <View
425
+ style={{
426
+ display: 'flex',
427
+ flexDirection: 'row',
428
+ alignContent: 'center',
429
+ alignItems: 'center',
430
+ }}
431
+ >
432
+ {tagsList && tagsList?.length > 1 && (
433
+ <View style={{ marginBottom: 20 }}>
434
+ <Tag
435
+ onPress={() => handleAllSelect()}
436
+ isSelected={
437
+ isEqual(currentOrdersGroup.currentFilter, tagsList)
438
+ ? theme.colors.primary
439
+ : theme.colors.tabBar
440
+ }>
441
+ <OText
442
+ style={styles.tag}
443
+ color={
444
+ isEqual(currentOrdersGroup.currentFilter, tagsList)
445
+ ? theme.colors.white
446
+ : theme.colors.black
447
+ }>
448
+ {t('All', 'All')}
449
+ </OText>
450
+ </Tag>
451
+ </View>
452
+ )}
453
+ <ScrollView
454
+ ref={scrollRef}
455
+ showsVerticalScrollIndicator={false}
456
+ showsHorizontalScrollIndicator={false}
457
+ contentContainerStyle={styles.tagsContainer}
458
+ horizontal
459
+ >
460
+ {tagsList && tagsList.map((key: number) => (
461
+ <Tag
462
+ key={key}
463
+ onPress={() => !currentOrdersGroup.loading && handleTagSelected(key)}
464
+ isSelected={
465
+ currentOrdersGroup.currentFilter.includes(key) &&
466
+ !isEqual(currentOrdersGroup.currentFilter, tagsList)
467
+ ? theme.colors.primary
468
+ : theme.colors.tabBar
469
+ }>
470
+ <OText
471
+ style={styles.tag}
472
+ color={
473
+ currentOrdersGroup.currentFilter.includes(key) &&
474
+ !isEqual(currentOrdersGroup.currentFilter, tagsList)
475
+ ? theme.colors.white
476
+ : theme.colors.black
477
+ }>
478
+ {getOrderStatus(key)}
479
+ {
480
+ currentOrdersGroup.currentFilter.includes(key) &&
481
+ !isEqual(currentOrdersGroup.currentFilter, tagsList) &&
482
+ ' X'
483
+ }
484
+ </OText>
485
+ </Tag>
486
+ ))}
487
+ </ScrollView>
488
+ </View>
489
+ )}
490
+
491
+ <View style={{ paddingBottom: 220 }}>
492
+ <ScrollView
493
+ ref={scrollListRef}
494
+ showsVerticalScrollIndicator={false}
495
+ nestedScrollEnabled={true}
496
+ refreshControl={
497
+ <RefreshControl
498
+ refreshing={refreshing}
499
+ onRefresh={() => {
500
+ currentTabSelected === 'logisticOrders'
501
+ ? loadLogisticOrders && loadLogisticOrders()
502
+ : loadOrders && loadOrders({ newFetch: true })
503
+ }}
504
+ />
505
+ }
506
+ >
507
+ {!currentOrdersGroup?.error?.length &&
508
+ currentOrdersGroup?.orders?.length > 0 &&
509
+ currentTabSelected !== 'logisticOrders' &&
510
+ (
511
+ <PreviousOrders
512
+ orders={currentOrdersGroup?.orders}
513
+ onNavigationRedirect={onNavigationRedirect}
514
+ getOrderStatus={getOrderStatus}
515
+ handleClickOrder={handleClickOrder}
516
+ slaSettingTime={slaSettingTime}
517
+ currentTabSelected={currentTabSelected}
518
+ handleClickEvent={setCurrentOrderSelected}
519
+ currentOrdenSelected={currentOrderSelected?.id}
520
+ />
521
+ )}
522
+ {!logisticOrders?.error?.length &&
523
+ logisticOrders && logisticOrders?.orders?.length > 0 &&
524
+ currentTabSelected === 'logisticOrders' && (
525
+ <PreviousOrders
526
+ orders={logisticOrders?.orders?.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
527
+ onNavigationRedirect={onNavigationRedirect}
528
+ getOrderStatus={getOrderStatus}
529
+ handleClickLogisticOrder={handleClickLogisticOrder}
530
+ isLogisticOrder
531
+ handleClickEvent={setCurrentOrderSelected}
532
+ currentOrdenSelected={currentOrderSelected?.id}
533
+ />
534
+ )
535
+ }
536
+ {((currentOrdersGroup?.loading ||
537
+ currentOrdersGroup?.pagination?.total === null) ||
538
+ (logisticOrders?.loading)) &&
539
+ (
540
+ <>
541
+ <View>
542
+ {[...Array(8)].map((_, i) => (
543
+ <Placeholder key={i} Animation={Fade}>
544
+ <View
545
+ style={{
546
+ width: '100%',
547
+ flexDirection: 'row',
548
+ marginBottom: 10,
549
+ }}>
550
+ <PlaceholderLine
551
+ width={IS_PORTRAIT ? 22 : 11}
552
+ height={74}
553
+ style={{
554
+ marginRight: 20,
555
+ marginBottom: 20,
556
+ borderRadius: 7.6,
557
+ }}
558
+ />
559
+ <Placeholder>
560
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
561
+ <PlaceholderLine width={50} />
562
+ <PlaceholderLine width={20} />
563
+ </Placeholder>
564
+ </View>
565
+ </Placeholder>
566
+ ))}
567
+ </View>
568
+ </>
569
+ )}
570
+
571
+ {!currentOrdersGroup?.error?.length &&
572
+ !currentOrdersGroup?.loading &&
573
+ currentOrdersGroup?.pagination?.totalPages &&
574
+ currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
575
+ currentOrdersGroup?.orders?.length > 0 &&
576
+ (
577
+ <OButton
578
+ onClick={() => loadMoreOrders && loadMoreOrders()}
579
+ text={t('LOAD_MORE_ORDERS', 'Load more orders')}
580
+ imgRightSrc={null}
581
+ textStyle={styles.loadButtonText}
582
+ style={styles.loadButton}
583
+ bgColor={theme.colors.primary}
584
+ borderColor={theme.colors.primary}
585
+ />
586
+ )}
587
+
588
+ {((!currentOrdersGroup?.loading &&
589
+ (currentOrdersGroup?.error?.length ||
590
+ currentOrdersGroup?.orders?.length === 0)) ||
591
+ (currentTabSelected === 'logisticOrders' &&
592
+ (logisticOrders && logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired)))
593
+ ) &&
594
+ (
595
+ <NotFoundSource
596
+ content={
597
+ ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
598
+ (currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
599
+ ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
600
+ : currentOrdersGroup?.error?.[0]?.message ||
601
+ currentOrdersGroup?.error?.[0] ||
602
+ (currentTabSelected === 'logisticOrders' && logisticOrders?.error) ||
603
+ t('NETWORK_ERROR', 'Network Error')
604
+ }
605
+ image={theme.images.general.notFound}
606
+ conditioned={false}
607
+ />
608
+ )}
609
+ </ScrollView>
610
+ </View>
611
+ </LeftSide>
612
+
613
+ <RightSide style={{ paddingBottom: 110, paddingHorizontal: 20 }}>
614
+ {currentOrderSelected && (
615
+ <OrderDetailsBusiness {...props.orderDetailsProps} order={currentOrderSelected} isCustomView />
616
+ )}
617
+ </RightSide>
618
+ </Sides>
619
+
620
+ <NewOrderNotification isBusinessApp={isBusinessApp} />
621
+ {(openSearchModal || openSLASettingModal) && (
622
+ <OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
623
+ <ModalContainer
624
+ nestedScrollEnabled={true}
625
+ >
626
+ <OIconButton
627
+ icon={theme.images.general.arrow_left}
628
+ borderColor={theme.colors.clear}
629
+ iconColor={theme.colors.backArrow}
630
+ iconStyle={{ width: 20, height: 13 }}
631
+ style={{
632
+ maxWidth: 40,
633
+ height: 35,
634
+ justifyContent: 'flex-end',
635
+ marginBottom: 30,
636
+ marginTop: 30
637
+ }}
638
+ onClick={() => handleClose()}
639
+ />
640
+ {openSearchModal && (
641
+ <SearchModalContent>
642
+ <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
643
+ <OInput
644
+ value={search.id}
645
+ onChange={(value: any) => setSearch({ ...search, id: value })}
646
+ style={styles.inputStyle}
647
+ placeholder={t('ORDER_NUMBER', 'Order number')}
648
+ autoCorrect={false}
649
+ />
650
+ <OrdersOptionDate
651
+ {...props}
652
+ search={search}
653
+ onSearch={setSearch}
654
+ />
655
+ <OrdersOptionCity
656
+ {...props}
657
+ search={search}
658
+ onSearch={setSearch}
659
+ />
660
+ {isBusinessApp && (
661
+ <>
662
+ <OrdersOptionBusiness
663
+ {...props}
664
+ search={search}
665
+ onSearch={setSearch}
666
+ />
667
+ <OrdersOptionDelivery
668
+ {...props}
669
+ search={search}
670
+ onSearch={setSearch}
671
+ />
672
+ <OrdersOptionDriver
673
+ {...props}
674
+ search={search}
675
+ onSearch={setSearch}
676
+ />
677
+ <OrdersOptionPaymethod
678
+ {...props}
679
+ search={search}
680
+ onSearch={setSearch}
681
+ />
682
+ </>
683
+ )}
684
+ <OButton
685
+ text={t('SEARCH', 'Search')}
686
+ textStyle={{ color: theme.colors.white }}
687
+ imgRightSrc={null}
688
+ style={{
689
+ borderRadius: 7.6,
690
+ marginBottom: 70,
691
+ marginTop: 60,
692
+ zIndex: 12
693
+ }}
694
+ onClick={applyFilters}
695
+ />
696
+
697
+ </SearchModalContent>
698
+ )}
699
+ {openSLASettingModal && (
700
+ <SlaSettingModalContent>
701
+ <ModalTitle>{t('SLA_SETTINGS', 'SLA’s Settings')}</ModalTitle>
702
+ <FiltersTab>
703
+ <ScrollView
704
+ ref={scrollRefTab}
705
+ showsVerticalScrollIndicator={false}
706
+ showsHorizontalScrollIndicator={false}
707
+ horizontal
708
+ nestedScrollEnabled={true}
709
+ >
710
+ <TabsContainer>
711
+ {defaultOrderTypes && defaultOrderTypes.map((tab: any) => (
712
+ <TabPressable
713
+ key={tab.key}
714
+ onPress={() => setCurrentDeliveryType(tab?.name)}
715
+ isSelected={tab.name.toUpperCase() === currentDeliveryType.toUpperCase() ? 1 : 0}
716
+ >
717
+ <OText
718
+ style={{
719
+ ...styles.tab,
720
+ fontSize: tab.name.toUpperCase() === currentDeliveryType.toUpperCase() ? 14 : 12,
721
+ borderBottomWidth: Platform.OS === 'ios' && tab.name.toUpperCase() === currentDeliveryType.toUpperCase() ? 1 : 0,
722
+ }}
723
+ color={
724
+ tab.name.toUpperCase() === currentDeliveryType.toUpperCase()
725
+ ? theme.colors.textGray
726
+ : theme.colors.unselectText
727
+ }
728
+ weight={tab.name.toUpperCase() === currentDeliveryType ? '600' : 'normal'}
729
+ >
730
+ {tab.name}
731
+ </OText>
732
+ </TabPressable>
733
+ ))}
734
+ </TabsContainer>
735
+ </ScrollView>
736
+ </FiltersTab>
737
+ <DeliveryStatusWrapper>
738
+ {selectedTabStatus && selectedTabStatus.length > 0 && selectedTabStatus.map((item: any, i: any) => (
739
+ <StatusBlock
740
+ key={i}
741
+ item={item}
742
+ last={i + 1 === selectedTabStatus.length}
743
+ />
744
+ ))}
745
+ <VerticalLine />
746
+ </DeliveryStatusWrapper>
747
+ </SlaSettingModalContent>
748
+ )}
749
+ </ModalContainer>
750
+ </OModal>
751
+ )}
752
+ </>
753
+ );
754
+ };
755
+
756
+
757
+ export const OrdersListManager = (props: OrdersOptionParams) => {
758
+ const [, t] = useLanguage();
759
+ const ordersProps = {
760
+ ...props,
761
+ UIComponent: OrdersListManagerUI,
762
+ useDefualtSessionManager: true,
763
+ asDashboard: true,
764
+ isIos: Platform.OS === 'ios',
765
+ orderStatus: [
766
+ { key: 0, text: t('PENDING', 'Pending') },
767
+ { key: 1, text: t('COMPLETED', 'Completed') },
768
+ { key: 2, text: t('REJECTED', 'Rejected') },
769
+ { key: 3, text: t('DRIVER_IN_BUSINESS', 'Driver in business') },
770
+ { key: 4, text: t('READY_FOR_PICKUP', 'Ready for pickup') },
771
+ { key: 5, text: t('REJECTED_BY_BUSINESS', 'Rejected by business') },
772
+ { key: 6, text: t('REJECTED_BY_DRIVER', 'Rejected by Driver') },
773
+ { key: 7, text: t('ACCEPTED_BY_BUSINESS', 'Accepted by business') },
774
+ { key: 8, text: t('ACCEPTED_BY_DRIVER', 'Accepted by driver') },
775
+ {
776
+ key: 9,
777
+ text: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
778
+ },
779
+ {
780
+ key: 10,
781
+ text: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
782
+ },
783
+ {
784
+ key: 11,
785
+ text: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver'),
786
+ },
787
+ {
788
+ key: 12,
789
+ text: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
790
+ },
791
+ { key: 13, text: t('PREORDER', 'Preorder') },
792
+ { key: 14, text: t('ORDER_NOT_READY', 'Order not ready') },
793
+ {
794
+ key: 15,
795
+ text: t(
796
+ 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
797
+ 'Order picked up completed by customer',
798
+ ),
799
+ },
800
+ { key: 16, text: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer') },
801
+ {
802
+ key: 17,
803
+ text: t(
804
+ 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
805
+ 'Order not picked up by customer',
806
+ ),
807
+ },
808
+ {
809
+ key: 18,
810
+ text: t(
811
+ 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
812
+ 'Driver almost arrived to business',
813
+ ),
814
+ },
815
+ {
816
+ key: 19,
817
+ text: t(
818
+ 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
819
+ 'Driver almost arrived to customer',
820
+ ),
821
+ },
822
+ {
823
+ key: 20,
824
+ text: t(
825
+ 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
826
+ 'Customer almost arrived to business',
827
+ ),
828
+ },
829
+ {
830
+ key: 21,
831
+ text: t(
832
+ 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
833
+ 'Customer arrived to business',
834
+ ),
835
+ },
836
+ {
837
+ key: 22,
838
+ text: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver')
839
+ },
840
+ {
841
+ key: 23,
842
+ text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
843
+ }
844
+ ],
845
+ tabs: [
846
+ {
847
+ key: 0,
848
+ text: t('PENDING', 'Pending'),
849
+ tags: props?.orderGroupStatusCustom?.pending ?? [0, 13],
850
+ title: 'pending'
851
+ },
852
+ {
853
+ key: 1,
854
+ text: t('IN_PROGRESS', 'In Progress'),
855
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
856
+ title: 'inProgress',
857
+ },
858
+ {
859
+ key: 2,
860
+ text: t('COMPLETED', 'Completed'),
861
+ tags: props?.orderGroupStatusCustom?.completed ?? [1, 11, 15],
862
+ title: 'completed',
863
+ },
864
+ {
865
+ key: 3,
866
+ text: t('CANCELLED', 'Cancelled'),
867
+ tags: props?.orderGroupStatusCustom?.cancelled ?? [2, 5, 6, 10, 12, 16, 17],
868
+ title: 'cancelled',
869
+ },
870
+ ]
871
+ };
872
+
873
+ return <OrderListGroups {...ordersProps} />;
874
+ };