ordering-ui-react-native 0.21.21 → 0.21.22-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/package.json +7 -6
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +4 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +2 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +4 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +23 -14
  18. package/themes/business/src/components/DriverMap/index.tsx +4 -3
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/Home/index.tsx +5 -1
  21. package/themes/business/src/components/LanguageSelector/index.tsx +4 -2
  22. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  23. package/themes/business/src/components/MapView/index.tsx +11 -7
  24. package/themes/business/src/components/MessagesOption/index.tsx +2 -1
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +163 -113
  26. package/themes/business/src/components/OrderDetails/Business.tsx +50 -2
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +23 -11
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +60 -53
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +54 -23
  30. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  32. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  33. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  34. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  35. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  36. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +33 -36
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +18 -13
  39. package/themes/business/src/components/PreviousOrders/index.tsx +80 -66
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  41. package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
  42. package/themes/business/src/components/PrinterSettings/styles.tsx +17 -0
  43. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  44. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  45. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  46. package/themes/business/src/components/Sessions/index.tsx +187 -0
  47. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  48. package/themes/business/src/components/StoresList/index.tsx +5 -3
  49. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  50. package/themes/business/src/components/UserProfileForm/index.tsx +98 -44
  51. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  52. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  53. package/themes/business/src/components/shared/OInput.tsx +2 -0
  54. package/themes/business/src/hooks/useLocation.tsx +5 -4
  55. package/themes/business/src/types/index.tsx +15 -2
  56. package/themes/business/src/utils/index.tsx +5 -0
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  61. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -4
  62. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  63. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  65. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  66. package/themes/original/index.tsx +9 -4
  67. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  68. package/themes/original/src/components/AddressForm/index.tsx +10 -6
  69. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  70. package/themes/original/src/components/AddressList/index.tsx +4 -7
  71. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  72. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  73. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  74. package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  76. package/themes/original/src/components/BusinessController/index.tsx +20 -12
  77. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  78. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  79. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  80. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  81. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  82. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  83. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  84. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  85. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -3
  86. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  88. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  89. package/themes/original/src/components/BusinessProductsListing/index.tsx +51 -20
  90. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  91. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  92. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  100. package/themes/original/src/components/Cart/index.tsx +32 -9
  101. package/themes/original/src/components/CartContent/index.tsx +96 -58
  102. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +190 -66
  104. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  105. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  106. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  107. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  108. package/themes/original/src/components/Favorite/index.tsx +4 -9
  109. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  110. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  111. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  112. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  113. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  114. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  115. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  116. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  117. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  118. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  119. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  120. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  121. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  122. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  123. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  124. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  125. package/themes/original/src/components/GoogleMap/index.tsx +6 -5
  126. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  127. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  128. package/themes/original/src/components/Home/index.tsx +2 -1
  129. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  130. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  131. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  132. package/themes/original/src/components/Messages/index.tsx +9 -4
  133. package/themes/original/src/components/Messages/styles.tsx +1 -1
  134. package/themes/original/src/components/MomentOption/index.tsx +4 -3
  135. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  136. package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
  137. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  139. package/themes/original/src/components/MyOrders/index.tsx +24 -29
  140. package/themes/original/src/components/NavBar/index.tsx +3 -1
  141. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  142. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  143. package/themes/original/src/components/Notifications/index.tsx +4 -8
  144. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  146. package/themes/original/src/components/OrderDetails/index.tsx +716 -668
  147. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  148. package/themes/original/src/components/OrderProgress/index.tsx +28 -6
  149. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  150. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  154. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  155. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  156. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  157. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  158. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  159. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  160. package/themes/original/src/components/PaymentOptions/index.tsx +72 -6
  161. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  162. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  163. package/themes/original/src/components/ProductForm/index.tsx +74 -165
  164. package/themes/original/src/components/ProductItemAccordion/index.tsx +54 -44
  165. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  166. package/themes/original/src/components/ProductOptionSubOption/index.tsx +123 -82
  167. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +6 -1
  168. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  169. package/themes/original/src/components/Promotions/index.tsx +4 -4
  170. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  171. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  172. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  173. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  174. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  175. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  176. package/themes/original/src/components/SignupForm/index.tsx +60 -58
  177. package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
  178. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  180. package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +72 -59
  182. package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
  183. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  184. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  185. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  186. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  187. package/themes/original/src/components/UserFormDetails/index.tsx +125 -77
  188. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  189. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  190. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  191. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  192. package/themes/original/src/components/Wallets/index.tsx +8 -9
  193. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  194. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  195. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  196. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  197. package/themes/original/src/components/shared/OButton.tsx +5 -5
  198. package/themes/original/src/components/shared/OInput.tsx +1 -4
  199. package/themes/original/src/components/shared/OModal.tsx +12 -14
  200. package/themes/original/src/layouts/Container.tsx +5 -3
  201. package/themes/original/src/types/index.tsx +1 -0
  202. package/themes/original/src/utils/index.tsx +125 -1
  203. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  204. package/src/navigators/BottomNavigator.tsx +0 -117
  205. package/src/navigators/CheckoutNavigator.tsx +0 -66
  206. package/src/navigators/HomeNavigator.tsx +0 -202
  207. package/src/navigators/NavigationRef.tsx +0 -7
  208. package/src/navigators/RootNavigator.tsx +0 -269
  209. package/src/pages/Account.tsx +0 -34
  210. package/src/pages/AddressForm.tsx +0 -62
  211. package/src/pages/AddressList.tsx +0 -24
  212. package/src/pages/BusinessProductsList.tsx +0 -81
  213. package/src/pages/BusinessesListing.tsx +0 -43
  214. package/src/pages/CartList.tsx +0 -49
  215. package/src/pages/Checkout.tsx +0 -101
  216. package/src/pages/ForgotPassword.tsx +0 -24
  217. package/src/pages/Help.tsx +0 -23
  218. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  219. package/src/pages/HelpGuide.tsx +0 -23
  220. package/src/pages/HelpOrder.tsx +0 -23
  221. package/src/pages/Home.tsx +0 -36
  222. package/src/pages/IntroductoryTutorial.tsx +0 -170
  223. package/src/pages/Login.tsx +0 -47
  224. package/src/pages/MomentOption.tsx +0 -30
  225. package/src/pages/MultiCheckout.tsx +0 -31
  226. package/src/pages/MultiOrdersDetails.tsx +0 -27
  227. package/src/pages/MyOrders.tsx +0 -40
  228. package/src/pages/NetworkError.tsx +0 -24
  229. package/src/pages/NotFound.tsx +0 -22
  230. package/src/pages/OrderDetails.tsx +0 -25
  231. package/src/pages/ProductDetails.tsx +0 -55
  232. package/src/pages/Profile.tsx +0 -36
  233. package/src/pages/ReviewDriver.tsx +0 -30
  234. package/src/pages/ReviewOrder.tsx +0 -32
  235. package/src/pages/ReviewProducts.tsx +0 -30
  236. package/src/pages/Sessions.tsx +0 -22
  237. package/src/pages/Signup.tsx +0 -53
  238. package/src/pages/SpinnerLoader.tsx +0 -10
  239. package/src/pages/Splash.tsx +0 -21
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useCallback } from 'react'
2
2
 
3
3
  import { Platform, StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';
4
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
4
5
 
5
6
  import { OButton, OText, OLink, OModal } from '../shared'
6
7
  import {
@@ -53,6 +54,7 @@ export const OrderContentComponent = (props: OrderContent) => {
53
54
  const WIDTH_SCREEN = orientationState?.dimensions?.width
54
55
 
55
56
  const [openReviewModal, setOpenReviewModal] = useState(false)
57
+ const [showCustomFields, setShowCustomFields] = useState<boolean>(false);
56
58
 
57
59
  const [isReadMore, setIsReadMore] = useState({
58
60
  customerAddress: false,
@@ -111,6 +113,7 @@ export const OrderContentComponent = (props: OrderContent) => {
111
113
  }
112
114
 
113
115
  const containsOnlyNumbers = (str: string) => {
116
+ str = str?.replace('+', '');
114
117
  return /^\d+$/.test(str);
115
118
  }
116
119
 
@@ -133,27 +136,36 @@ export const OrderContentComponent = (props: OrderContent) => {
133
136
 
134
137
  {order?.metafields?.length > 0 && (
135
138
  <OrderBusiness>
136
- <OText style={{ marginBottom: 5 }} size={16} weight="600">
137
- {t('CUSTOM_FIELDS', 'Custom fields')}
138
- </OText>
139
-
140
- {order.metafields.map((field: any) => (
141
- <View
142
- key={field.id}
143
- style={{
144
- width: '100%',
145
- flexDirection: 'row',
146
- marginBottom: 5
147
- }}
148
- >
149
- <OText style={{ width: '50%' }}>
150
- {field.key}
151
- </OText>
152
- <OText style={{ width: '45%', textAlign: 'right' }}>
153
- {field.value}
154
- </OText>
155
- </View>
156
- ))}
139
+ <TouchableOpacity onPress={() => setShowCustomFields((prev: boolean) => !prev)} style={{ flexDirection: 'row', width: '100%', justifyContent: 'space-between', alignItems: 'flex-start' }}>
140
+ <OText style={{ marginBottom: 5 }} size={16} weight="600">
141
+ {t('CUSTOM_FIELDS', 'Custom fields')}
142
+ </OText>
143
+ <AntDesignIcon
144
+ name={showCustomFields ? 'up' : 'down'}
145
+ size={14}
146
+ />
147
+ </TouchableOpacity>
148
+ {showCustomFields && (
149
+ <>
150
+ {order.metafields.map((field: any) => (
151
+ <View
152
+ key={field.id}
153
+ style={{
154
+ width: '100%',
155
+ flexDirection: 'row',
156
+ marginBottom: 5
157
+ }}
158
+ >
159
+ <OText style={{ width: '50%' }}>
160
+ {field.key}
161
+ </OText>
162
+ <OText style={{ width: '45%', textAlign: 'right' }}>
163
+ {field.value}
164
+ </OText>
165
+ </View>
166
+ ))}
167
+ </>
168
+ )}
157
169
  </OrderBusiness>
158
170
  )}
159
171
 
@@ -183,7 +195,7 @@ export const OrderContentComponent = (props: OrderContent) => {
183
195
  <OLink
184
196
  PressStyle={styles.linkWithIcons}
185
197
  url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.cellphone : 'invalid'}`}
186
- shorcut={`${order?.business?.cellphone}`}
198
+ shorcut={`${(!!order?.business?.country_phone_code && !order?.business?.cellphone?.includes('+')) ? '+' + order?.business?.country_phone_code : ''}${order?.business?.cellphone}`}
187
199
  TextStyle={styles.textLink}
188
200
  />
189
201
  </View>
@@ -193,8 +205,8 @@ export const OrderContentComponent = (props: OrderContent) => {
193
205
  <View style={styles.linkWithIcons}>
194
206
  <OLink
195
207
  PressStyle={styles.linkWithIcons}
196
- url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.phone : 'invalid'}`}
197
- shorcut={order?.business?.phone}
208
+ url={`tel:${containsOnlyNumbers(order?.business?.phone) ? order?.business?.phone : 'invalid'}`}
209
+ shorcut={`${(!!order?.business?.country_phone_code && !order?.business?.phone?.includes('+')) ? '+' + order?.business?.country_phone_code : ''}${order?.business?.phone}`}
198
210
  TextStyle={styles.textLink}
199
211
  />
200
212
  </View>
@@ -207,8 +219,8 @@ export const OrderContentComponent = (props: OrderContent) => {
207
219
  <OLink
208
220
  PressStyle={styles.linkWithIcons}
209
221
  url={Platform.select({
210
- ios: `maps:0,0?q=${order?.business?.address}`,
211
- android: `geo:0,0?q=${order?.business?.address}`,
222
+ ios: `maps:0,0?q=${order?.business?.address}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
223
+ android: `geo:0,0?q=${order?.business?.address}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
212
224
  })}
213
225
  numberOfLines={2}
214
226
  shorcut={order?.business?.address}
@@ -227,8 +239,8 @@ export const OrderContentComponent = (props: OrderContent) => {
227
239
  <OLink
228
240
  PressStyle={styles.linkWithIcons}
229
241
  url={Platform.select({
230
- ios: `maps:0,0?q=${order?.business?.address_notes}`,
231
- android: `geo:0,0?q=${order?.business?.address_notes}`,
242
+ ios: `maps:0,0?q=${order?.business?.address_notes}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
243
+ android: `geo:0,0?q=${order?.business?.address_notes}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
232
244
  })}
233
245
  shorcut={order?.business?.address_notes}
234
246
  TextStyle={styles.textLink}
@@ -325,7 +337,7 @@ export const OrderContentComponent = (props: OrderContent) => {
325
337
  <OLink
326
338
  PressStyle={styles.linkWithIcons}
327
339
  url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${containsOnlyNumbers(order?.customer?.cellphone) ? order?.customer?.cellphone : 'invalid'}`}
328
- shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
340
+ shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''}${order?.customer?.cellphone}`}
329
341
  TextStyle={styles.textLink}
330
342
  />
331
343
  </View>
@@ -335,8 +347,8 @@ export const OrderContentComponent = (props: OrderContent) => {
335
347
  <View style={styles.linkWithIcons}>
336
348
  <OLink
337
349
  PressStyle={styles.linkWithIcons}
338
- url={`tel:${containsOnlyNumbers(order?.customer?.phone) ? order?.customer?.phone : 'invalid'}`}
339
- shorcut={order?.customer?.phone}
350
+ url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${containsOnlyNumbers(order?.customer?.phone) ? order?.customer?.phone : 'invalid'}`}
351
+ shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''}${order?.customer?.phone}`}
340
352
  TextStyle={styles.textLink}
341
353
  />
342
354
  </View>
@@ -348,8 +360,8 @@ export const OrderContentComponent = (props: OrderContent) => {
348
360
  <OLink
349
361
  PressStyle={{ ...styles.linkWithIcons, marginBottom: 0 }}
350
362
  url={Platform.select({
351
- ios: `maps:0,0?q=${order?.customer?.address}`,
352
- android: `geo:0,0?q=${order?.customer?.address}`,
363
+ ios: `maps:0,0?q=${order?.customer?.address}@${order?.customer?.location?.lat},${order?.customer?.location?.lng}`,
364
+ android: `geo:0,0?q=${order?.customer?.address}@${order?.customer?.location?.lat},${order?.customer?.location?.lng}`,
353
365
  })}
354
366
  onTextLayout={e => onTextLayout(e, 'customerAddress')}
355
367
  numberOfLines={isReadMore.customerAddress ? 20 : 2}
@@ -396,23 +408,13 @@ export const OrderContentComponent = (props: OrderContent) => {
396
408
  {t('ON_BEHALF_OF', 'On behalf of')}{': '} {order?.on_behalf_of}
397
409
  </OText>
398
410
  )}
399
- {((order?.delivery_option !== undefined && order?.delivery_type === 1) || !!order?.comment) && (
411
+ {(order?.delivery_option !== undefined && order?.delivery_type === 1) && (
400
412
  <View style={{ marginTop: 10 }}>
401
413
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
402
414
  <OText>
403
415
  {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
404
416
  </OText>
405
417
  )}
406
- {!!order?.comment && (
407
- <>
408
- <OText weight='500' style={{ marginBottom: 5 }}>
409
- {t('ORDER_COMMENT', 'Order Comment')}
410
- </OText>
411
- <OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 20 }}>
412
- {order?.comment}
413
- </OText>
414
- </>
415
- )}
416
418
  </View>
417
419
  )}
418
420
  {!order?.user_review && pastOrderStatuses.includes(order?.status) && (
@@ -427,10 +429,16 @@ export const OrderContentComponent = (props: OrderContent) => {
427
429
  </OrderCustomer>
428
430
 
429
431
  <OrderProducts>
430
- <OText style={{ marginBottom: 5 }} size={16} weight="600">
432
+ <OText style={{ marginBottom: 10 }} size={16} weight="600">
431
433
  {t('ORDER_DETAILS', 'Order Details')}
432
434
  </OText>
433
435
 
436
+ {!!order?.comment && (
437
+ <OText>
438
+ {`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
439
+ </OText>
440
+ )}
441
+
434
442
  {order?.products?.length > 0 &&
435
443
  order?.products.map((product: any, i: number) => (
436
444
  <ProductItemAccordion
@@ -549,7 +557,7 @@ export const OrderContentComponent = (props: OrderContent) => {
549
557
  ))
550
558
  }
551
559
  {
552
- typeof order?.summary?.delivery_price === 'number' && (
560
+ typeof order?.summary?.delivery_price === 'number' && order.delivery_type !== 2 && (
553
561
  <Table>
554
562
  <OText mBottom={4}>
555
563
  {t('DELIVERY_FEE', 'Delivery Fee')}
@@ -576,7 +584,7 @@ export const OrderContentComponent = (props: OrderContent) => {
576
584
  </Table>
577
585
  ))
578
586
  }
579
- {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && (
587
+ {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 && (
580
588
  <Table>
581
589
  <OText mBottom={4}>
582
590
  {t('DRIVER_TIP', 'Driver tip')}
@@ -634,13 +642,12 @@ export const OrderContentComponent = (props: OrderContent) => {
634
642
  <OText>
635
643
  {event?.wallet_event
636
644
  ? walletName[event?.wallet_event?.wallet?.type]?.name
637
- : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
645
+ : event?.paymethod?.gateway
646
+ ? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
647
+ : order?.paymethod?.id === event?.paymethod_id
648
+ ? t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
649
+ : ''}
638
650
  </OText>
639
- {/* {event?.data?.charge_id && (
640
- <OText>
641
- {`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
642
- </OText>
643
- )} */}
644
651
  </View>
645
652
  <OText>
646
653
  {(event?.paymethod?.gateway === 'cash' && order?.cash)
@@ -49,7 +49,8 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
49
49
  } = props
50
50
  const theme = useTheme();
51
51
  const [, t] = useLanguage();
52
- const [{ parseDate }] = useUtils();
52
+ const [{ parseDate, parsePrice }] = useUtils();
53
+ const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
53
54
 
54
55
  const styles = StyleSheet.create({
55
56
  icons: {
@@ -120,6 +121,30 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
120
121
  ? t('CURBSIDE', 'Curbside')
121
122
  : t('DRIVER_THRU', 'Driver thru')
122
123
 
124
+ const handlePaymethodsListString = () => {
125
+ const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
126
+ return paymethod?.wallet_event
127
+ ? walletName[paymethod?.wallet_event?.wallet?.type]?.name
128
+ : paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
129
+ ? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
130
+ : paymethod?.paymethod?.gateway
131
+ ? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
132
+ : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
133
+ })
134
+ return paymethodsList.join(', ')
135
+ }
136
+
137
+ const deliveryDate = () => {
138
+ const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
139
+ const currentDate = new Date();
140
+ const receivedDate: any = new Date(order?.delivery_datetime);
141
+
142
+ const formattedDate = receivedDate <= currentDate
143
+ ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
144
+ : parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
145
+ return formattedDate
146
+ }
147
+
123
148
  return (
124
149
  <>
125
150
  {!props.isCustomView && (
@@ -182,16 +207,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
182
207
  <OrderHeader>
183
208
  {!props.isCustomView ? (
184
209
  <OText size={13} style={{ marginBottom: 5 }}>
185
- {order?.delivery_datetime_utc
186
- ? parseDate(order?.delivery_datetime_utc)
187
- : parseDate(order?.delivery_datetime, { utc: false })}
210
+ {deliveryDate()}
188
211
  </OText>
189
212
  ) : (
190
213
  <Header style={{ alignItems: 'center' }}>
191
214
  <OText size={13} style={{ marginBottom: 5 }}>
192
- {order?.delivery_datetime_utc
193
- ? parseDate(order?.delivery_datetime_utc)
194
- : parseDate(order?.delivery_datetime, { utc: false })}
215
+ {deliveryDate()}
195
216
  </OText>
196
217
 
197
218
  {(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
@@ -263,6 +284,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
263
284
  )}
264
285
  </>
265
286
  </OText>
287
+ {order?.external_id && (
288
+ <OText size={13}>
289
+ <OText size={13} weight='bold'>{`${t('EXTERNAL_ID', 'External ID :')} `}</OText>
290
+ {order?.external_id}
291
+ </OText>
292
+ )}
266
293
  {!order?.isLogistic && !!order?.delivery_type && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
267
294
  <>
268
295
  <OText size={13}>
@@ -275,23 +302,27 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
275
302
  {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
276
303
  </OText>
277
304
  )}
278
- {order?.payment_events?.length > 0 && (
279
- <View>
280
- <OText size={13}>
281
- <OText size={13} weight='bold'>
282
- {`${t('PAYMENT_METHODS', 'Payment methods')}: `}
283
- </OText>
284
- {order?.payment_events?.map((event: any, idx: number) => {
285
- return event?.wallet_event
286
- ? idx < order?.payment_events?.length - 1
287
- ? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
288
- : walletName[event?.wallet_event?.wallet?.type]?.name
289
- : idx < order?.payment_events?.length - 1
290
- ? `${t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)} - `
291
- : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
292
- })}
305
+ <OText>
306
+ <OText size={13} weight='bold'>
307
+ {`${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: `}
308
+ </OText>
309
+ {order?.payment_events?.length > 0 ? (
310
+ <OText size={13}>{`${handlePaymethodsListString()}`}</OText>
311
+ ) : (
312
+ <OText size={13}>{t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}</OText>
313
+ )}
314
+ </OText>
315
+ {order?.spot_number && (
316
+ <OText size={13}>
317
+ <OText size={13} weight='bold'>
318
+ {`${order?.delivery_type === 3
319
+ ? t('EATIN_SPOT_NUMBER', 'Table number')
320
+ : order?.delivery_type === 5
321
+ ? t('DRIVE_THRU_SPOT_NUMBER', 'Drive thru lane')
322
+ : t('CURBSIDE_SPOT_NUMBER', 'Spot number')}: `}
293
323
  </OText>
294
- </View>
324
+ {order.spot_number}
325
+ </OText>
295
326
  )}
296
327
  </>
297
328
  )}
@@ -0,0 +1,220 @@
1
+ import { useConfig, useUtils, useLanguage} from 'ordering-components/native'
2
+
3
+ import { verifyDecimals, getProductPrice } from '../../utils';
4
+
5
+ /**
6
+ * Hook to create commands for star micronics printer using PassPRNT library
7
+ * @returns array of strings
8
+ */
9
+
10
+ export const usePrinterCommands = () => {
11
+ const [, t] = useLanguage()
12
+ const [{ configs }] = useConfig();
13
+ const [{ parsePrice, parseNumber, parseDate }] = useUtils();
14
+
15
+ const deliveryStatus: any = {
16
+ 1: t('DELIVERY', 'Delivery'),
17
+ 2: t('PICK_UP', 'Pick up'),
18
+ 3: t('EAT_IN', 'Eat In'),
19
+ 4: t('CURBSIDE', 'Curbside'),
20
+ 5: t('DRIVER_THRU', 'Driver thru'),
21
+ };
22
+
23
+ const walletName: any = {
24
+ cash: {
25
+ name: t('CASH_WALLET', 'Cash Wallet')
26
+ },
27
+ credit_point: {
28
+ name: t('POINTS_WALLET', 'Points Wallet')
29
+ }
30
+ }
31
+
32
+ const percentTip = (order: any) =>
33
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
34
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
35
+ verifyDecimals(order?.summary?.driver_tip, parseNumber);
36
+
37
+ const handlePaymethodsListString = (order: any) => {
38
+ const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
39
+ return paymethod?.wallet_event
40
+ ? walletName[paymethod?.wallet_event?.wallet?.type]?.name
41
+ : paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
42
+ ? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
43
+ : paymethod?.paymethod?.gateway
44
+ ? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
45
+ : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
46
+ })
47
+ return paymethodsList.join(', ')
48
+ }
49
+
50
+ const paymethodsLength = (order: any) => order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
51
+
52
+ const customerName = (order: any) => `${order?.customer?.name ?? ''} ${order?.customer?.middle_name ?? ''} ${order?.customer?.lastname ?? ''} ${order?.customer?.second_lastname ?? ''}`?.replace(' ', ' ')?.trim() ?? ''
53
+
54
+ const deliveryDate = (order: any) => {
55
+ const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
56
+ const currentDate = new Date();
57
+ const receivedDate: any = new Date(order?.delivery_datetime);
58
+
59
+ const formattedDate = receivedDate <= currentDate
60
+ ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
61
+ : parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
62
+ return formattedDate
63
+ }
64
+
65
+ const generateProductsText = (order: any, { endLine }: any) => {
66
+ const list: any = []
67
+
68
+ if (order?.products.length) {
69
+ order?.products.map((product: any) => {
70
+ list.push(`${product?.quantity} ${product?.name} \t ${parsePrice(product.total ?? getProductPrice(product))}${endLine}`)
71
+
72
+ if (product?.ingredients?.length) {
73
+ list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: 10 } })
74
+ product?.ingredients?.map((ingredient: any) => {
75
+ list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: 10 })
76
+ })
77
+ }
78
+
79
+ product.options?.map((option: any) => {
80
+ list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: 10 } })
81
+
82
+ option.suboptions?.map((suboption: any) => {
83
+ const { quantity, name, position, price } = suboption
84
+ const pos = position && position !== 'whole' ? `(${t(position.toUpperCase(), position)})` : ''
85
+ const string = name !== 'No'
86
+ ? pos
87
+ ? `${quantity} x ${name} ${pos} +${parsePrice(price)}`
88
+ : `${quantity} x ${name} +${parsePrice(price)}`
89
+ : 'No'
90
+
91
+ list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: 10 } })
92
+ })
93
+ })
94
+
95
+ if (product.comment) {
96
+ list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: 10 } })
97
+ list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: 10 } })
98
+ }
99
+
100
+ list.push('_separator_')
101
+ })
102
+ }
103
+
104
+ return list
105
+ }
106
+
107
+ const paymethodsList = (order: any, { endLine }: any) => {
108
+ const list: any = []
109
+
110
+ if (order?.payment_events?.length > 0) {
111
+ order?.payment_events.map((event: any) => {
112
+ const payment = event?.wallet_event
113
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
114
+ : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
115
+
116
+ const amount = (event?.paymethod?.gateway === 'cash' && order?.cash)
117
+ ? parsePrice(order?.cash, { currency: order?.currency })
118
+ : `-${parsePrice(event?.amount, { currency: order?.currency })}`
119
+
120
+ list.push(`${payment} \t ${amount}${endLine}`)
121
+ })
122
+ }
123
+
124
+ return list
125
+ }
126
+
127
+ const replaceChars = (string: string) => {
128
+ const accents: any = {
129
+ 'á': 'a',
130
+ 'é': 'e',
131
+ 'í': 'i',
132
+ 'ó': 'o',
133
+ 'ú': 'u',
134
+ 'Á': 'A',
135
+ 'É': 'E',
136
+ 'Í': 'I',
137
+ 'Ó': 'O',
138
+ 'Ú': 'U',
139
+ 'ü': 'u',
140
+ 'Ü': 'U',
141
+ 'ñ': 'n',
142
+ 'Ñ': 'N',
143
+ "'": '',
144
+ "’": '',
145
+ "`": '',
146
+ };
147
+ return string.replace(/[áéíóúÁÉÍÓÚüÜñÑ'’`]/g, (match: any) => accents[match])
148
+ }
149
+
150
+ const generateCommands = (order: any, printMode: string = 'append') => {
151
+ let commands: any = [];
152
+
153
+ const isAppendMode = printMode === 'append'
154
+ const jumpLine = isAppendMode ? '\n' : ' '
155
+ const endLine = isAppendMode ? '\n' : ''
156
+
157
+ const textProps = { fontSize: 12 }
158
+
159
+ const appends: any = [
160
+ { text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: 16 } },
161
+ jumpLine,
162
+ `${order.orderStatus}${endLine}`,
163
+ { text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: 14 } },
164
+ { text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: 14 } },
165
+ `${!!order?.delivery_option ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}` : ''}`,
166
+ `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${endLine}`,
167
+ '_separator_',
168
+ { text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: 14 } },
169
+ `${t('FULL_NAME', 'Full Name')}: ${customerName(order)}${endLine}`,
170
+ `${t('EMAIL', 'Email')}: ${order?.customer?.email}${endLine}`,
171
+ `${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}${endLine}` : ''}`,
172
+ `${!!order?.customer?.phone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone}${endLine}` : ''}`,
173
+ `${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}${endLine}`,
174
+ `${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}${endLine}` : ''}`,
175
+ `${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}${endLine}` : ''}`,
176
+ '_separator_',
177
+ { text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: 14 } },
178
+ `${order?.business?.name}${endLine}`,
179
+ `${order?.business?.email}${endLine}`,
180
+ `${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}${endLine}` : ''}`,
181
+ `${!!order?.business?.phone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone}${endLine}` : ''}`,
182
+ `${t('ADDRESS', 'Address')}: ${order?.business?.address}${endLine}`,
183
+ `${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}${endLine}` : ''}`,
184
+ '_separator_',
185
+ { text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: 14 } },
186
+ `${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}${endLine}` : ''}`,
187
+ ...generateProductsText(order, { endLine }),
188
+ `${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}${endLine}`,
189
+ `${order?.summary?.discount > 0 ? `${order?.offer_type === 1 ? `${t('DISCOUNT', 'Discount')} (${verifyDecimals(order?.offer_rate, parsePrice)}%)${endLine}` : t('DISCOUNT', 'Discount')} \t\t ${parsePrice(order?.summary?.discount)}${endLine}` : ''}`,
190
+ `${order?.tax_type !== 1 ? `${t('TAX', 'Tax')} (${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%) \t\t ${parsePrice(order?.summary?.tax ?? 0)}${endLine}` : ''}`,
191
+ `${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ? `${t('DELIVERY_FEE', 'Delivery Fee')} \t\t ${parsePrice(order?.summary?.delivery_price ?? 0)}${endLine}` : ''}`,
192
+ `${(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 ? `${t('DRIVER_TIP', 'Driver tip')} ${percentTip(order) ? `(${percentTip(order)}%)` : ''} \t\t ${parsePrice(order?.summary?.driver_tip ?? 0)}${endLine}` : ''}`,
193
+ `${order?.summary?.service_fee > 0 ? `${t('SERVICE_FEE', 'Service Fee')} (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%) \t\t ${parsePrice(order?.summary?.service_fee ?? 0)}${endLine}` : ''}`,
194
+ '_separator_',
195
+ `${t('TOTAL', 'Total')} \t\t ${parsePrice(order?.summary?.total ?? 0)}${endLine}`,
196
+ jumpLine,
197
+ `${order?.payment_events?.length > 0 ? `${t('PAYMENTS', 'Payments')}${endLine}` : ''}`,
198
+ ...paymethodsList(order, { endLine }),
199
+ jumpLine,
200
+ jumpLine,
201
+ ]
202
+
203
+ commands = [
204
+ ...commands,
205
+ ...appends.map((append: any) => {
206
+ return append === '_separator_'
207
+ ? { [printMode]: `---------------------------------------${endLine}` }
208
+ : {
209
+ [printMode]: replaceChars(append?.text ?? append),
210
+ ...textProps,
211
+ ...append?.props
212
+ }
213
+ })
214
+ ]
215
+
216
+ return commands
217
+ }
218
+
219
+ return { generateCommands }
220
+ }
@@ -10,6 +10,7 @@ import {
10
10
  useLanguage,
11
11
  OrderDetails as OrderDetailsConTableoller,
12
12
  useSession,
13
+ useConfig
13
14
  } from 'ordering-components/native';
14
15
 
15
16
  //Components
@@ -34,6 +35,8 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
34
35
  const theme = useTheme();
35
36
  const [, t] = useLanguage();
36
37
  const [session] = useSession();
38
+ const [{ configs }] = useConfig();
39
+
37
40
  const [alertState, setAlertState] = useState<{
38
41
  open: boolean;
39
42
  content: Array<string>;
@@ -41,6 +44,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
41
44
  }>({ open: false, content: [], key: null });
42
45
 
43
46
  const logisticOrderStatus = [4, 6, 7]
47
+ const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
44
48
 
45
49
  const showFloatButtonsAcceptOrReject: any = {
46
50
  0: true,
@@ -166,7 +170,8 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
166
170
  secondButton={true}
167
171
  firstColorCustom={theme.colors.red}
168
172
  secondColorCustom={theme.colors.green}
169
- widthButton={'45%'}
173
+ widthButton={isHideRejectButtons ? '100%': '45%'}
174
+ isHideRejectButtons={isHideRejectButtons}
170
175
  />
171
176
  )}
172
177
  </>