ordering-ui-react-native 0.17.53 → 0.17.54-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 (217) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/OrderCreating/index.tsx +1 -21
  5. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  6. package/src/components/PhoneInputNumber/index.tsx +6 -2
  7. package/src/components/StripeMethodForm/index.tsx +136 -102
  8. package/src/components/VerifyPhone/styles.tsx +1 -2
  9. package/src/components/shared/OToast.tsx +4 -4
  10. package/src/types/index.tsx +5 -0
  11. package/src/utils/index.tsx +5 -0
  12. package/themes/business/index.tsx +2 -0
  13. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  14. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +125 -113
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +29 -2
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  21. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  22. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  23. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  24. package/themes/business/src/components/MapView/index.tsx +10 -10
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  26. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  27. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +93 -50
  28. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +63 -62
  29. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  30. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  31. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  32. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  33. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  34. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +249 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  36. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  38. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  39. package/themes/business/src/components/ReviewCustomer/index.tsx +30 -15
  40. package/themes/business/src/components/StoresList/index.tsx +2 -2
  41. package/themes/business/src/components/UserProfileForm/index.tsx +11 -13
  42. package/themes/business/src/components/shared/OLink.tsx +33 -13
  43. package/themes/business/src/components/shared/OModal.tsx +16 -9
  44. package/themes/business/src/components/shared/OText.tsx +8 -2
  45. package/themes/business/src/types/index.tsx +32 -2
  46. package/themes/business/src/utils/index.tsx +44 -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/Checkout/index.tsx +6 -0
  51. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  52. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  53. package/themes/kiosk/src/components/LoginForm/index.tsx +480 -156
  54. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  59. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  60. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  61. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  62. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  63. package/themes/kiosk/src/types/index.d.ts +13 -0
  64. package/themes/kiosk/src/utils/index.tsx +15 -0
  65. package/themes/original/index.tsx +4 -0
  66. package/themes/original/src/components/AddressDetails/index.tsx +28 -10
  67. package/themes/original/src/components/AddressForm/index.tsx +68 -40
  68. package/themes/original/src/components/AddressList/index.tsx +27 -22
  69. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  70. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  71. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  72. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  73. package/themes/original/src/components/BusinessBasicInformation/index.tsx +152 -95
  74. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
  75. package/themes/original/src/components/BusinessController/index.tsx +122 -68
  76. package/themes/original/src/components/BusinessController/styles.tsx +23 -4
  77. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  78. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  79. package/themes/original/src/components/BusinessInformation/index.tsx +110 -108
  80. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +352 -326
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +25 -15
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  86. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +668 -514
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  89. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +97 -91
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -4
  93. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  94. package/themes/original/src/components/Cart/index.tsx +77 -50
  95. package/themes/original/src/components/CartContent/index.tsx +115 -19
  96. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  97. package/themes/original/src/components/Checkout/index.tsx +359 -171
  98. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  99. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  100. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  101. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  102. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  103. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  104. package/themes/original/src/components/Favorite/index.tsx +8 -9
  105. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  106. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  107. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  108. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  109. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  110. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  111. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  112. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  113. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  114. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  115. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  116. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  117. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  118. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  119. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  120. package/themes/original/src/components/GoogleMap/index.tsx +15 -4
  121. package/themes/original/src/components/Help/index.tsx +8 -8
  122. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  123. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  124. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  125. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  126. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  127. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  128. package/themes/original/src/components/Home/index.tsx +13 -4
  129. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  130. package/themes/original/src/components/LoginForm/Otp/index.tsx +55 -13
  131. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  132. package/themes/original/src/components/LoginForm/index.tsx +64 -26
  133. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  134. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  135. package/themes/original/src/components/Messages/index.tsx +32 -10
  136. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  137. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  138. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +151 -49
  139. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  140. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  141. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  142. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  143. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  144. package/themes/original/src/components/MyOrders/index.tsx +77 -52
  145. package/themes/original/src/components/NavBar/index.tsx +18 -18
  146. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  147. package/themes/original/src/components/Notifications/index.tsx +46 -50
  148. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  149. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  150. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  151. package/themes/original/src/components/OrderDetails/index.tsx +190 -358
  152. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  153. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  154. package/themes/original/src/components/OrderProgress/index.tsx +33 -59
  155. package/themes/original/src/components/OrderSummary/index.tsx +85 -57
  156. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  157. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  158. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  159. package/themes/original/src/components/OrdersOption/index.tsx +76 -66
  160. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  161. package/themes/original/src/components/PageBanner/index.tsx +107 -40
  162. package/themes/original/src/components/PageBanner/styles.tsx +4 -1
  163. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  164. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  165. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  166. package/themes/original/src/components/PaymentOptions/index.tsx +64 -7
  167. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  168. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  169. package/themes/original/src/components/ProductForm/index.tsx +109 -33
  170. package/themes/original/src/components/ProductForm/styles.tsx +5 -7
  171. package/themes/original/src/components/ProductItemAccordion/index.tsx +22 -19
  172. package/themes/original/src/components/ProductOptionSubOption/index.tsx +24 -14
  173. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +3 -4
  174. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  175. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  176. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  177. package/themes/original/src/components/Promotions/index.tsx +234 -220
  178. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  179. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  180. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  181. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  182. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  183. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  184. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  185. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  186. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  187. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  188. package/themes/original/src/components/Sessions/index.tsx +11 -8
  189. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  190. package/themes/original/src/components/SignupForm/index.tsx +43 -20
  191. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  192. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  193. package/themes/original/src/components/SingleProductCard/index.tsx +71 -34
  194. package/themes/original/src/components/SingleProductCard/styles.tsx +21 -4
  195. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  196. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  197. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  198. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  199. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  200. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  201. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  202. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  203. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  204. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  205. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  206. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  207. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  208. package/themes/original/src/components/Wallets/index.tsx +67 -24
  209. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  210. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  211. package/themes/original/src/components/shared/OButton.tsx +6 -2
  212. package/themes/original/src/components/shared/OInput.tsx +6 -1
  213. package/themes/original/src/components/shared/OModal.tsx +3 -3
  214. package/themes/original/src/layouts/Container.tsx +1 -1
  215. package/themes/original/src/types/index.tsx +40 -11
  216. package/themes/original/src/utils/index.tsx +375 -58
  217. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,195 @@
1
+ //React & React Native
2
+ import React, { useState, useEffect } from 'react';
3
+ import { View } from 'react-native';
4
+
5
+ // Thirds
6
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
7
+
8
+ //OrderingComponent
9
+ import {
10
+ useLanguage,
11
+ OrderDetails as OrderDetailsConTableoller,
12
+ useSession,
13
+ } from 'ordering-components/native';
14
+
15
+ //Components
16
+ import Alert from '../../providers/AlertProvider';
17
+ import { FloatingButton } from '../FloatingButton';
18
+ import { OrderDetailsLogisticParams } from '../../types';
19
+ import { useTheme } from 'styled-components/native';
20
+ import { NotFoundSource } from '../NotFoundSource';
21
+ import { getOrderStatus } from '../../utils';
22
+ import { OrderHeaderComponent } from '../OrderDetails/OrderHeaderComponent';
23
+ import { OrderContentComponent } from '../OrderDetails/OrderContentComponent';
24
+ //Styles
25
+ import { OrderDetailsContainer } from './styles';
26
+
27
+ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
28
+ const {
29
+ navigation,
30
+ handleClickLogisticOrder,
31
+ orderAssingId,
32
+ } = props;
33
+ const { order } = props.order
34
+ const theme = useTheme();
35
+ const [, t] = useLanguage();
36
+ const [session] = useSession();
37
+ const [alertState, setAlertState] = useState<{
38
+ open: boolean;
39
+ content: Array<string>;
40
+ key?: string | null;
41
+ }>({ open: false, content: [], key: null });
42
+
43
+ const logisticOrderStatus = [4, 6, 7]
44
+
45
+ const showFloatButtonsAcceptOrReject: any = {
46
+ 0: true,
47
+ 4: true,
48
+ 7: true,
49
+ 14: true
50
+ };
51
+
52
+ const handleArrowBack: any = () => {
53
+ navigation?.canGoBack() && navigation.goBack();
54
+ };
55
+
56
+ const handleRejectLogisticOrder = (order: any) => {
57
+ handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id, order)
58
+ handleArrowBack()
59
+ }
60
+
61
+ const handleAcceptLogisticOrder = (order: any) => {
62
+ handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id, order)
63
+ handleArrowBack()
64
+ }
65
+
66
+ useEffect(() => {
67
+ if (order?.driver === null && session?.user?.level === 4) {
68
+ setAlertState({
69
+ open: true,
70
+ content: [
71
+ t(
72
+ 'YOU_HAVE_BEEN_REMOVED_FROM_THE_ORDER',
73
+ 'You have been removed from the order',
74
+ ),
75
+ ],
76
+ key: null,
77
+ });
78
+ }
79
+ }, [order?.driver]);
80
+
81
+ const OrderDetailsInformation = (props: { order: any, isOrderGroup?: boolean, lastOrder?: boolean }) => {
82
+ const {
83
+ order,
84
+ isOrderGroup,
85
+ lastOrder,
86
+ } = props
87
+ return (
88
+ <>
89
+ <OrderContentComponent
90
+ order={order}
91
+ logisticOrderStatus={logisticOrderStatus}
92
+ isOrderGroup={isOrderGroup}
93
+ lastOrder={lastOrder}
94
+ />
95
+ <View
96
+ style={{
97
+ height:
98
+ order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
99
+ }}
100
+ />
101
+
102
+ </>
103
+ )
104
+ }
105
+
106
+ return (
107
+ <>
108
+ {(!order || Object.keys(order).length === 0) &&
109
+ (props.order?.error?.length < 1 || !props.order?.error) && (
110
+ <View style={{ flex: 1 }}>
111
+ {[...Array(6)].map((item, i) => (
112
+ <Placeholder key={i} Animation={Fade}>
113
+ <View style={{ flexDirection: 'row', paddingVertical: 20 }}>
114
+ <Placeholder>
115
+ <PlaceholderLine width={100} />
116
+ <PlaceholderLine width={70} />
117
+ <PlaceholderLine width={30} />
118
+ <PlaceholderLine width={20} />
119
+ </Placeholder>
120
+ </View>
121
+ </Placeholder>
122
+ ))}
123
+ </View>
124
+ )}
125
+
126
+ {(!!props.order?.error || props.order?.error) && (
127
+ <NotFoundSource
128
+ btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
129
+ content={
130
+ props.order.error[0] ||
131
+ props.order.error ||
132
+ t('NETWORK_ERROR', 'Network Error')
133
+ }
134
+ onClickButton={() => navigation.navigate('Orders')}
135
+ />
136
+ )}
137
+ {!((!order || Object.keys(order).length === 0) &&
138
+ (props.order?.error?.length < 1 || !props.order?.error)) && (
139
+ <View style={{ flex: 1 }}>
140
+ <OrderHeaderComponent
141
+ order={order}
142
+ getOrderStatus={getOrderStatus}
143
+ handleArrowBack={handleArrowBack}
144
+ logisticOrderStatus={logisticOrderStatus}
145
+ />
146
+ {order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
147
+ <>
148
+ <OrderDetailsContainer
149
+ keyboardShouldPersistTaps="handled"
150
+ showsVerticalScrollIndicator={false}
151
+ >
152
+ {order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
153
+ <OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
154
+ )) : (
155
+ <OrderDetailsInformation order={order} />
156
+ )}
157
+ </OrderDetailsContainer>
158
+
159
+ {showFloatButtonsAcceptOrReject[order?.status] && (
160
+ <FloatingButton
161
+ btnText={t('REJECT', 'Reject')}
162
+ isSecondaryBtn={false}
163
+ secondButtonClick={() => handleAcceptLogisticOrder(order)}
164
+ firstButtonClick={() => handleRejectLogisticOrder(order)}
165
+ secondBtnText={t('ACCEPT', 'Accept')}
166
+ secondButton={true}
167
+ firstColorCustom={theme.colors.red}
168
+ secondColorCustom={theme.colors.green}
169
+ widthButton={'45%'}
170
+ />
171
+ )}
172
+ </>
173
+ )}
174
+ </View>
175
+ )}
176
+ {alertState?.open && (
177
+ <Alert
178
+ open={alertState.open}
179
+ onAccept={handleArrowBack}
180
+ onClose={handleArrowBack}
181
+ content={alertState.content}
182
+ title={t('WARNING', 'Warning')}
183
+ />
184
+ )}
185
+ </>
186
+ );
187
+ };
188
+
189
+ export const OrderDetailsLogistic = (props: OrderDetailsLogisticParams) => {
190
+ const orderDetailsProps = {
191
+ ...props,
192
+ UIComponent: OrderDetailsLogisticUI,
193
+ };
194
+ return <OrderDetailsConTableoller {...orderDetailsProps} />;
195
+ };
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const OrderDetailsContainer = styled.ScrollView`
4
+ flex: 1;
5
+ `;
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
3
3
  import { Chat } from '../Chat';
4
- import { StyleSheet, View, BackHandler } from 'react-native';
4
+ import { StyleSheet, View, BackHandler, TouchableOpacity } from 'react-native';
5
5
  import {
6
6
  useLanguage,
7
7
  OrderDetails as OrderDetailsController,
@@ -9,7 +9,7 @@ import {
9
9
  } from 'ordering-components/native';
10
10
  import { useUtils } from 'ordering-components/native';
11
11
 
12
- import { OIcon, OIconButton, OText } from '../shared';
12
+ import { OIcon, OText } from '../shared';
13
13
  import { OrderDetailsParams } from '../../types';
14
14
  import { USER_TYPE } from '../../config/constants';
15
15
  import { useTheme } from 'styled-components/native';
@@ -146,13 +146,6 @@ export const OrderMessageUI = (props: OrderDetailsParams) => {
146
146
  shadowRadius: 3.84,
147
147
  elevation: 3,
148
148
  },
149
- cancelBtn: {
150
- marginRight: 5,
151
- zIndex: 10000,
152
- height: 30,
153
- width: 20,
154
- justifyContent: 'flex-end',
155
- },
156
149
  modalText: {
157
150
  fontFamily: 'Poppins',
158
151
  fontStyle: 'normal',
@@ -161,6 +154,18 @@ export const OrderMessageUI = (props: OrderDetailsParams) => {
161
154
  textAlign: 'center',
162
155
  zIndex: 10,
163
156
  },
157
+ btnBackArrow: {
158
+ borderWidth: 0,
159
+ width: 32,
160
+ height: 32,
161
+ tintColor: theme.colors.textGray,
162
+ backgroundColor: theme.colors.clear,
163
+ borderColor: theme.colors.clear,
164
+ shadowColor: theme.colors.clear,
165
+ paddingLeft: 0,
166
+ paddingRight: 0,
167
+ marginTop: 10
168
+ },
164
169
  });
165
170
 
166
171
  return (
@@ -260,13 +265,9 @@ export const OrderMessageUI = (props: OrderDetailsParams) => {
260
265
  <>
261
266
  <View style={styles.titleSection}>
262
267
  <View style={styles.titleGroups}>
263
- <OIconButton
264
- icon={theme.images.general.arrow_left}
265
- iconStyle={{ width: 23, height: 23 }}
266
- borderColor={theme.colors.clear}
267
- style={styles.cancelBtn}
268
- onClick={handleArrowBack}
269
- />
268
+ <TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
269
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
270
+ </TouchableOpacity>
270
271
 
271
272
  <OText size={16} style={styles.modalText} adjustsFontSizeToFit>
272
273
  {`${t('INVOICE_ORDER_NO', 'Order No.')} ${order?.id}`}
@@ -292,7 +293,7 @@ export const OrderMessageUI = (props: OrderDetailsParams) => {
292
293
  <OIcon
293
294
  url={optimizeImage(
294
295
  order?.customer?.photo ||
295
- theme?.images?.dummies?.customerPhoto,
296
+ theme?.images?.dummies?.customerPhoto,
296
297
  'h_300,c_limit',
297
298
  )}
298
299
  style={styles.titleIcons}
@@ -23,7 +23,7 @@ import { useTheme } from 'styled-components/native';
23
23
 
24
24
  import { ProductItemAccordion } from '../ProductItemAccordion';
25
25
 
26
- export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
26
+ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermission, getPermissions, isGrantedPermissions, checkBluetoothPermission }: any) => {
27
27
  const handleArrowBack: any = () => {
28
28
  navigation?.canGoBack() && navigation.goBack();
29
29
  };
@@ -48,10 +48,10 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
48
48
  const getSuboptions = (suboptions: any) => {
49
49
  const array: any = []
50
50
  suboptions?.length > 0 &&
51
- suboptions?.map((suboption: any) => {
52
- const string = `&nbsp;&nbsp;&nbsp;${getFormattedSubOptionName(suboption)}<br/>`
53
- array.push(string)
54
- })
51
+ suboptions?.map((suboption: any) => {
52
+ const string = `&nbsp;&nbsp;&nbsp;${getFormattedSubOptionName(suboption)}<br/>`
53
+ array.push(string)
54
+ })
55
55
 
56
56
  return array.join('')
57
57
  }
@@ -60,12 +60,12 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
60
60
  const array: any = [];
61
61
 
62
62
  options?.length &&
63
- options?.map((option: any) => {
64
- const string =
65
- ` ${option.name}<br/>${getSuboptions(option.suboptions)}`;
63
+ options?.map((option: any) => {
64
+ const string =
65
+ ` ${option.name}<br/>${getSuboptions(option.suboptions)}`;
66
66
 
67
- array.push(string)
68
- })
67
+ array.push(string)
68
+ })
69
69
 
70
70
  if (productComment) {
71
71
  array.push(`${t('COMMENT', 'Comment')}<br/>&nbsp;&nbsp;&nbsp;&nbsp;${productComment}`)
@@ -88,46 +88,38 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
88
88
 
89
89
  ${orderStatus} </br>
90
90
 
91
- ${t('DELIVERY_TYPE', 'Delivery Type')}: ${
92
- deliveryStatus[order?.delivery_type]
93
- }
91
+ ${t('DELIVERY_TYPE', 'Delivery Type')}: ${deliveryStatus[order?.delivery_type]
92
+ }
94
93
  </br>
95
- ${t('DELIVERY_DATE', 'Delivery Date')}: ${
96
- order?.delivery_datetime_utc
94
+ ${t('DELIVERY_DATE', 'Delivery Date')}: ${order?.delivery_datetime_utc
97
95
  ? parseDate(order?.delivery_datetime_utc)
98
96
  : parseDate(order?.delivery_datetime, { utc: false })
99
- }
97
+ }
100
98
  </br>
101
99
  ${t('PAYMENT_METHOD')}: ${order?.paymethod?.name}
102
100
  </p>
103
101
 
104
102
  <h1>${t('CUSTOMER_DETAILS', 'Customer details')}</h1>
105
- <p style="font-size: 27px"> ${t('FULL_NAME', 'Full Name')}: ${
106
- order?.customer?.name
107
- } ${order?.customer?.middle_name} ${order?.customer?.lastname} ${
108
- order?.customer?.second_lastname
109
- }
103
+ <p style="font-size: 27px"> ${t('FULL_NAME', 'Full Name')}: ${order?.customer?.name
104
+ } ${order?.customer?.middle_name} ${order?.customer?.lastname} ${order?.customer?.second_lastname
105
+ }
110
106
  </br>
111
107
  ${t('EMAIL', 'Email')}: ${order?.customer?.email}
112
108
  </br>
113
109
  ${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}
114
110
  </br>
115
- ${
116
- !!order?.customer?.phone
117
- ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${
118
- order?.customer?.phone
119
- } </br>`
120
- : ''
121
- }
111
+ ${!!order?.customer?.phone
112
+ ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone
113
+ } </br>`
114
+ : ''
115
+ }
122
116
  ${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}
123
117
  </br>
124
- ${
125
- !!order?.customer?.internal_number
126
- ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${
127
- order?.customer?.internal_number
128
- } </br>`
129
- : ''
130
- }
118
+ ${!!order?.customer?.internal_number
119
+ ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number
120
+ } </br>`
121
+ : ''
122
+ }
131
123
  ${t('ZIPCODE', 'Zipcode')}: ${order?.customer.zipcode}
132
124
  </p>
133
125
 
@@ -139,30 +131,26 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
139
131
  </br>
140
132
  ${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}
141
133
  </br>
142
- ${
143
- !!order?.business?.phone
144
- ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${
145
- order?.business?.phone
146
- } </br>`
147
- : ''
148
- }
134
+ ${!!order?.business?.phone
135
+ ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone
136
+ } </br>`
137
+ : ''
138
+ }
149
139
 
150
140
  ${t('ADDRESS', 'Address')}: ${order?.business?.address}
151
141
  </br>
152
- ${
153
- !!order?.business?.address_notes
154
- ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${
155
- order?.business?.address_notes
156
- } `
157
- : ''
158
- }
142
+ ${!!order?.business?.address_notes
143
+ ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes
144
+ } `
145
+ : ''
146
+ }
159
147
  </p>
160
148
  <h1> ${t('ORDER_DETAILS', 'Order Details')}</h1>
161
149
 
162
150
  ${order?.products.length &&
163
- order?.products.map(
164
- (product: any, i: number) =>
165
- `<div style="display: flex;flexDirection:row;flex-wrap:wrap">
151
+ order?.products.map(
152
+ (product: any, i: number) =>
153
+ `<div style="display: flex;flexDirection:row;flex-wrap:wrap">
166
154
  <div style="display:flex;width:100%">
167
155
  <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
168
156
  ${product?.quantity} ${product?.name}
@@ -179,8 +167,8 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
179
167
  </div>
180
168
  </div>
181
169
  </div>`
182
- )
183
- }
170
+ )
171
+ }
184
172
  <div style="display: flex;">
185
173
 
186
174
  <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
@@ -189,62 +177,58 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
189
177
 
190
178
  <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
191
179
  ${parsePrice(
192
- order.tax_type === 1
193
- ? order?.summary?.subtotal + order?.summary?.tax ?? 0
194
- : order?.summary?.subtotal ?? 0,
195
- )}
180
+ order.tax_type === 1
181
+ ? order?.summary?.subtotal + order?.summary?.tax ?? 0
182
+ : order?.summary?.subtotal ?? 0,
183
+ )}
196
184
  </div>
197
185
 
198
186
  </div>
199
187
 
200
188
  <div style="display: flex">
201
- ${
202
- order?.summary?.discount > 0
203
- ? order?.offer_type === 1
204
- ? `<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
189
+ ${order?.summary?.discount > 0
190
+ ? order?.offer_type === 1
191
+ ? `<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
205
192
  ${t('DISCOUNT', 'Discount')} (${verifyDecimals(
206
- order?.offer_rate,
207
- parsePrice,
208
- )}%)
193
+ order?.offer_rate,
194
+ parsePrice,
195
+ )}%)
209
196
  </div>`
210
- : `<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%"> ${t(
211
- 'DISCOUNT',
212
- 'Discount',
213
- )}
197
+ : `<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%"> ${t(
198
+ 'DISCOUNT',
199
+ 'Discount',
200
+ )}
214
201
  </div>`
215
- : ''
216
- }
217
- ${
218
- order?.summary?.discount > 0
219
- ? `<div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">- ${parsePrice(
220
- order?.summary?.discount,
221
- )}
202
+ : ''
203
+ }
204
+ ${order?.summary?.discount > 0
205
+ ? `<div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">- ${parsePrice(
206
+ order?.summary?.discount,
207
+ )}
222
208
  </div>`
223
- : ''
224
- }
209
+ : ''
210
+ }
225
211
  </div>
226
212
 
227
- ${
228
- order?.tax_type !== 1
229
- ? `<div style="font-size: 25px">
213
+ ${order?.tax_type !== 1
214
+ ? `<div style="font-size: 25px">
230
215
  ${t('TAX', 'Tax')}
231
216
  ${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%
232
217
  ${parsePrice(order?.summary?.tax ?? 0)}
233
218
  ${t('TAX', 'Tax')}
234
219
  ${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%
235
220
  </div>`
236
- : ''
237
- }
238
-
239
- ${
240
- order?.summary?.delivery_price > 0
241
- ? `<div style="font-size: 25px;"> ${t(
242
- 'DELIVERY_FEE',
243
- 'Delivery Fee',
244
- )}
221
+ : ''
222
+ }
223
+
224
+ ${order?.summary?.delivery_price > 0
225
+ ? `<div style="font-size: 25px;"> ${t(
226
+ 'DELIVERY_FEE',
227
+ 'Delivery Fee',
228
+ )}
245
229
  </div>`
246
- : ''
247
- }
230
+ : ''
231
+ }
248
232
 
249
233
  <div style="display: flex">
250
234
 
@@ -336,6 +320,25 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
336
320
  },
337
321
  });
338
322
 
323
+ const handlePrint = async () => {
324
+ if (Platform.OS === 'ios') {
325
+ silentPrint()
326
+ return
327
+ }
328
+ const _permissions = await getPermissions()
329
+
330
+ if (!isGrantedPermissions) {
331
+ checkBluetoothPermission()
332
+ }
333
+ if (isGrantedPermissions) {
334
+ const response = await askBluetoothPermission();
335
+ const isGranted = _permissions.reduce((allPermissions: boolean, _permission: string) => allPermissions && response?.[_permission] === 'granted', true)
336
+ if (isGranted) {
337
+ printPDF()
338
+ }
339
+ }
340
+ };
341
+
339
342
  return (
340
343
  <>
341
344
  <Content>
@@ -364,17 +367,15 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
364
367
  </OText>
365
368
 
366
369
  <OText style={{ marginBottom: 5 }}>
367
- {`${t('DELIVERY_TYPE', 'Delivery Type')}: ${
368
- deliveryStatus[order?.delivery_type]
369
- }`}
370
+ {`${t('DELIVERY_TYPE', 'Delivery Type')}: ${deliveryStatus[order?.delivery_type]
371
+ }`}
370
372
  </OText>
371
373
 
372
374
  <OText style={{ marginBottom: 5 }}>
373
- {`${t('DELIVERY_DATE', 'Delivery Date')}: ${
374
- order?.delivery_datetime_utc
375
+ {`${t('DELIVERY_DATE', 'Delivery Date')}: ${order?.delivery_datetime_utc
375
376
  ? parseDate(order?.delivery_datetime_utc)
376
377
  : parseDate(order?.delivery_datetime, { utc: false })
377
- }`}
378
+ }`}
378
379
  </OText>
379
380
 
380
381
  <OText style={{ marginBottom: 5 }}>{`${t('PAYMENT_METHOD')}: ${t(
@@ -399,11 +400,9 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
399
400
  adjustsFontSizeToFit
400
401
  ellipsizeMode="tail"
401
402
  color={theme.colors.textGray}>
402
- {`${t('FULL_NAME', 'Full Name')}: ${order?.customer?.name} ${
403
- order?.customer?.middle_name
404
- } ${order?.customer?.lastname} ${
405
- order?.customer?.second_lastname
406
- }`}
403
+ {`${t('FULL_NAME', 'Full Name')}: ${order?.customer?.name} ${order?.customer?.middle_name
404
+ } ${order?.customer?.lastname} ${order?.customer?.second_lastname
405
+ }`}
407
406
  </OText>
408
407
 
409
408
  <OText
@@ -423,9 +422,8 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
423
422
  adjustsFontSizeToFit
424
423
  ellipsizeMode="tail"
425
424
  color={theme.colors.textGray}>
426
- {`${t('MOBILE_PHONE', 'Mobile Phone')}: ${
427
- order?.customer?.cellphone
428
- }`}
425
+ {`${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
426
+ }`}
429
427
  </OText>
430
428
 
431
429
  {!!order?.customer?.phone && (
@@ -436,9 +434,8 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
436
434
  adjustsFontSizeToFit
437
435
  ellipsizeMode="tail"
438
436
  color={theme.colors.textGray}>
439
- {`${t('MOBILE_PHONE', 'Mobile Phone')}: ${
440
- order?.customer?.phone
441
- }`}
437
+ {`${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone
438
+ }`}
442
439
  </OText>
443
440
  )}
444
441
 
@@ -508,9 +505,8 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
508
505
  numberOfLines={2}
509
506
  ellipsizeMode="tail"
510
507
  color={theme.colors.textGray}>
511
- {`${t('BUSINESS_PHONE', 'Business Phone')}: ${
512
- order?.business?.cellphone
513
- }`}
508
+ {`${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone
509
+ }`}
514
510
  </OText>
515
511
  )}
516
512
 
@@ -521,9 +517,8 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
521
517
  numberOfLines={2}
522
518
  ellipsizeMode="tail"
523
519
  color={theme.colors.textGray}>
524
- {`${t('BUSINESS_PHONE', 'Business Phone')}: ${
525
- order?.business?.phone
526
- }`}
520
+ {`${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone
521
+ }`}
527
522
  </OText>
528
523
  )}
529
524
 
@@ -545,9 +540,8 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
545
540
  adjustsFontSizeToFit
546
541
  ellipsizeMode="tail"
547
542
  color={theme.colors.textGray}>
548
- {`${t('SPECIAL_ADDRESS', 'Special Address')}: ${
549
- order?.business?.address_notes
550
- }`}
543
+ {`${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes
544
+ }`}
551
545
  </OText>
552
546
  )}
553
547
  </OrderBusiness>
@@ -686,9 +680,7 @@ export const OrderSummary = ({ order, navigation, orderStatus }: any) => {
686
680
 
687
681
  <View style={{ marginBottom: 0 }}>
688
682
  <FloatingButton
689
- firstButtonClick={() =>
690
- Platform.OS === 'ios' ? silentPrint() : printPDF()
691
- }
683
+ firstButtonClick={() => handlePrint()}
692
684
  btnText={t('PRINT', 'Print')}
693
685
  color={theme.colors.green}
694
686
  widthButton={'100%'}