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,7 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
- import { useLanguage } from 'ordering-components/native';
4
+ import { useLanguage, useConfig } from 'ordering-components/native';
5
5
 
6
6
  import { AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
7
7
 
@@ -24,12 +24,15 @@ export const PreviousOrders = (props: any) => {
24
24
  currentTabSelected,
25
25
  currentOrdenSelected,
26
26
  handleChangeOrderStatus,
27
- handleSendCustomerReview
27
+ handleSendCustomerReview,
28
+ isBusinessApp
28
29
  } = props;
29
30
 
30
31
  let hash: any = {};
31
32
  const [, t] = useLanguage();
32
33
  const theme = useTheme();
34
+ const [{ configs }] = useConfig();
35
+
33
36
 
34
37
  // const [, setCurrentTime] = useState()
35
38
  const [openModal, setOpenModal] = useState(false)
@@ -41,6 +44,9 @@ export const PreviousOrders = (props: any) => {
41
44
  const viewMapStatus = [9, 18, 19, 23]
42
45
  const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
43
46
  const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23]
47
+ const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1' && !isBusinessApp
48
+ const isEnabledOrderNotReady = configs?.order_not_ready_enabled?.value === '1'
49
+ const isEnabledFailedPickupDriver = configs?.failed_pickup_by_driver_enabled?.value === '1'
44
50
 
45
51
  const handlePressOrder = (order: any) => {
46
52
  if (order?.locked && isLogisticOrder) return
@@ -168,28 +174,30 @@ export const PreviousOrders = (props: any) => {
168
174
  }
169
175
  {_ordersGrouped[k][0]?.status === 0 && (
170
176
  <AcceptOrRejectOrderStyle>
171
- <OButton
172
- text={t('REJECT_ALL', 'Reject all')}
173
- bgColor={theme.colors.danger100}
174
- borderColor={theme.colors.danger100}
175
- imgRightSrc={null}
176
- style={{ borderRadius: 7, height: 40 }}
177
- parentStyle={{ width: '45%' }}
178
- textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
179
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
180
- action: 'reject',
181
- order: _ordersGrouped[k][0],
182
- ids: _ordersGrouped[k].map((o: any) => o.id),
183
- handleChangeOrderStatus
184
- })}
185
- />
177
+ {!isHideRejectButtons && (
178
+ <OButton
179
+ text={t('REJECT_ALL', 'Reject all')}
180
+ bgColor={theme.colors.danger100}
181
+ borderColor={theme.colors.danger100}
182
+ imgRightSrc={null}
183
+ style={{ borderRadius: 7, height: 40 }}
184
+ parentStyle={{ width: '45%' }}
185
+ textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
186
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
187
+ action: 'reject',
188
+ order: _ordersGrouped[k][0],
189
+ ids: _ordersGrouped[k].map((o: any) => o.id),
190
+ handleChangeOrderStatus
191
+ })}
192
+ />
193
+ )}
186
194
  <OButton
187
195
  text={t('ACCEPT_ALL', 'Accept all')}
188
196
  bgColor={theme.colors.success100}
189
197
  borderColor={theme.colors.success100}
190
198
  imgRightSrc={null}
191
199
  style={{ borderRadius: 7, height: 40 }}
192
- parentStyle={{ width: '45%' }}
200
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
193
201
  textStyle={{ color: theme.colors.success500, fontSize: 12 }}
194
202
  onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
195
203
  action: 'accept',
@@ -236,7 +244,7 @@ export const PreviousOrders = (props: any) => {
236
244
  />
237
245
  </AcceptOrRejectOrderStyle>
238
246
  )}
239
- {_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 &&
247
+ {_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 && !isHideRejectButtons && isEnabledOrderNotReady &&
240
248
  (
241
249
  <AcceptOrRejectOrderStyle>
242
250
  <OButton
@@ -276,26 +284,28 @@ export const PreviousOrders = (props: any) => {
276
284
  ![1].includes(_ordersGrouped[k][0]?.delivery_type) &&
277
285
  (
278
286
  <AcceptOrRejectOrderStyle>
279
- <OButton
280
- text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
281
- bgColor={theme.colors.danger100}
282
- borderColor={theme.colors.danger100}
283
- imgRightSrc={null}
284
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
285
- parentStyle={{ width: '45%' }}
286
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
287
- onClick={() => handleChangeOrderStatus(
288
- 17,
289
- _ordersGrouped[k].map((o: any) => o.id),
290
- )}
291
- />
287
+ {!isHideRejectButtons && (
288
+ <OButton
289
+ text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
290
+ bgColor={theme.colors.danger100}
291
+ borderColor={theme.colors.danger100}
292
+ imgRightSrc={null}
293
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
294
+ parentStyle={{ width: '45%' }}
295
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
296
+ onClick={() => handleChangeOrderStatus(
297
+ 17,
298
+ _ordersGrouped[k].map((o: any) => o.id),
299
+ )}
300
+ />
301
+ )}
292
302
  <OButton
293
303
  text={t('PICKUP_COMPLETED_BY_CUSTOMER', 'Pickup completed by customer')}
294
304
  bgColor={theme.colors.success100}
295
305
  borderColor={theme.colors.success100}
296
306
  imgRightSrc={null}
297
307
  style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
298
- parentStyle={{ width: '45%' }}
308
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
299
309
  textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
300
310
  onClick={() => handleChangeOrderStatus(
301
311
  15,
@@ -322,30 +332,32 @@ export const PreviousOrders = (props: any) => {
322
332
  })}
323
333
  />
324
334
  )}
325
- {!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && (
335
+ {!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && isEnabledFailedPickupDriver && (
326
336
  <AcceptOrRejectOrderStyle>
327
- <OButton
328
- text={t('PICKUP_FAILED', 'Pickup failed')}
329
- bgColor={theme.colors.danger100}
330
- borderColor={theme.colors.danger100}
331
- imgRightSrc={null}
332
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
333
- parentStyle={{ width: '45%' }}
334
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
335
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
336
- action: 'pickupFailed',
337
- order: _ordersGrouped[k][0],
338
- ids: _ordersGrouped[k].map((o: any) => o.id),
339
- handleChangeOrderStatus
340
- })}
341
- />
337
+ {!isHideRejectButtons && isEnabledOrderNotReady && (
338
+ <OButton
339
+ text={t('PICKUP_FAILED', 'Pickup failed')}
340
+ bgColor={theme.colors.danger100}
341
+ borderColor={theme.colors.danger100}
342
+ imgRightSrc={null}
343
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
344
+ parentStyle={{ width: '45%' }}
345
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
346
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
347
+ action: 'pickupFailed',
348
+ order: _ordersGrouped[k][0],
349
+ ids: _ordersGrouped[k].map((o: any) => o.id),
350
+ handleChangeOrderStatus
351
+ })}
352
+ />
353
+ )}
342
354
  <OButton
343
355
  text={t('PICKUP_COMPLETE', 'Pickup complete')}
344
356
  bgColor={theme.colors.success100}
345
357
  borderColor={theme.colors.success100}
346
358
  imgRightSrc={null}
347
359
  style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
348
- parentStyle={{ width: '45%' }}
360
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
349
361
  textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
350
362
  onClick={() => handleChangeOrderStatus(
351
363
  9,
@@ -356,28 +368,30 @@ export const PreviousOrders = (props: any) => {
356
368
  )}
357
369
  {!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) && (
358
370
  <AcceptOrRejectOrderStyle>
359
- <OButton
360
- text={t('DELIVERY_FAILED', 'Delivery Failed')}
361
- bgColor={theme.colors.danger100}
362
- borderColor={theme.colors.danger100}
363
- imgRightSrc={null}
364
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
365
- parentStyle={{ width: '45%' }}
366
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
367
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
368
- action: 'deliveryFailed',
369
- order: _ordersGrouped[k][0],
370
- ids: _ordersGrouped[k].map((o: any) => o.id),
371
- handleChangeOrderStatus
372
- })}
373
- />
371
+ {!isHideRejectButtons && (
372
+ <OButton
373
+ text={t('DELIVERY_FAILED', 'Delivery Failed')}
374
+ bgColor={theme.colors.danger100}
375
+ borderColor={theme.colors.danger100}
376
+ imgRightSrc={null}
377
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
378
+ parentStyle={{ width: '45%' }}
379
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
380
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
381
+ action: 'deliveryFailed',
382
+ order: _ordersGrouped[k][0],
383
+ ids: _ordersGrouped[k].map((o: any) => o.id),
384
+ handleChangeOrderStatus
385
+ })}
386
+ />
387
+ )}
374
388
  <OButton
375
389
  text={t('DELIVERY_COMPLETE', 'Delivery complete')}
376
390
  bgColor={theme.colors.success100}
377
391
  borderColor={theme.colors.success100}
378
392
  imgRightSrc={null}
379
393
  style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
380
- parentStyle={{ width: '45%' }}
394
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
381
395
  textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
382
396
  onClick={() => handleChangeOrderStatus(
383
397
  11,
@@ -41,6 +41,16 @@ export const Timestatus = styled.View`
41
41
  height: 55px;
42
42
  border-radius: 20px;
43
43
  top: 5px;
44
+
45
+ ${({ timeState }: any) => timeState === 'in_time' && css`
46
+ background-color: #00D27A;
47
+ `}
48
+ ${({ timeState }: any) => timeState === 'at_risk' && css`
49
+ background-color: #FFC700;
50
+ `}
51
+ ${({ timeState }: any) => timeState === 'delayed' && css`
52
+ background-color: #E63757;
53
+ `}
44
54
  `
45
55
 
46
56
  export const AccordionSection = styled.View`
@@ -0,0 +1,279 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { ScrollView, StyleSheet, TouchableOpacity, View, Dimensions } from 'react-native'
3
+ import { useForm, Controller } from 'react-hook-form';
4
+ import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'
5
+ import FeatherIcon from 'react-native-vector-icons/Feather'
6
+ import MCIcons from 'react-native-vector-icons/MaterialCommunityIcons'
7
+ import FAIcons from 'react-native-vector-icons/FontAwesome'
8
+ import { useTheme } from 'styled-components/native'
9
+ import ToggleSwitch from 'toggle-switch-react-native';
10
+ import { useLanguage } from 'ordering-components/native'
11
+
12
+ import { _setStoreData, _retrieveStoreData } from '../../providers/StoreUtil'
13
+ import { Container, EnabledAutoPrint } from './styles'
14
+ import { OText, OInput} from '../shared'
15
+
16
+ export const PrinterSettings = (props: any) => {
17
+ const { onClose } = props
18
+
19
+ const [currentPrinter, setCurrentPrinter] = useState<any>(null)
20
+ const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
21
+ const [layoutWidth, setLayoutWidth] = useState<any>({ actionsBtns: 0 })
22
+
23
+ const WIDTH_SCREEN = Dimensions.get('window').width
24
+
25
+ const [, t] = useLanguage()
26
+ const theme = useTheme()
27
+ const { handleSubmit, control, setValue, watch } = useForm();
28
+
29
+ const watchIp = watch('ip')
30
+ const isErrorIp = !/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i.test(watchIp)
31
+
32
+ const styles = StyleSheet.create({
33
+ icons: {
34
+ maxWidth: 40,
35
+ height: 40,
36
+ padding: 10,
37
+ alignItems: 'flex-end'
38
+ },
39
+ optionIcons: {
40
+ padding: 8,
41
+ borderWidth: 1,
42
+ marginRight: 10,
43
+ borderRadius: 8,
44
+ },
45
+ wIconContainer: {
46
+ flexDirection: 'row',
47
+ alignItems: 'center',
48
+ width: WIDTH_SCREEN - 60 - 40
49
+ },
50
+ wrapperContainer: {
51
+ flexDirection: 'column',
52
+ },
53
+ wrapperIcons: {
54
+ flexDirection: 'row',
55
+ justifyContent: 'flex-start',
56
+ marginBottom: 5,
57
+ },
58
+ inputStyle: {
59
+ height: 40,
60
+ borderWidth: 1,
61
+ borderRadius: 8,
62
+ },
63
+ label: {
64
+ color: theme.colors.textGray
65
+ },
66
+ })
67
+
68
+ const printerList = [
69
+ { model: 'mPOP', emulation: 'StarPRNT', portName1: 'BT:mPOP', type: 1, ip: '', printMode: 'append' },
70
+ { model: 'FVP10', emulation: 'StarLine', portName1: 'BT:FVP10', type: 1, ip: '', printMode: 'append' },
71
+ { model: 'TSP100', emulation: 'StarGraphic', portName1: 'BT:TSP100', type: 1, ip: '', printMode: 'appendBitmapText' },
72
+ { model: 'TSP100IV', emulation: 'StarLine', portName1: 'BT:TSP100iv', type: 1, ip: '', printMode: 'append' },
73
+ { model: 'TSP65011', emulation: 'StarLine', portName1: 'BT:TSP65011', type: 1, ip: '', printMode: 'append' },
74
+ { model: 'TSP7001', emulation: 'StarLine', portName1: 'BT:TSP7001', type: 1, ip: '', printMode: 'append' },
75
+ { model: 'TSP80011', emulation: 'StarLine', portName1: 'BT:TSP80011', type: 1, ip: '', printMode: 'append' },
76
+ { model: 'SP700', emulation: 'StarDotImpact', portName1: 'BT:SP700', type: 1, ip: '', printMode: 'append' },
77
+ { model: 'SM-S210i', emulation: 'EscPosMobile', portName1: 'BT:SMS210i', type: 1, ip: '', printMode: 'append' },
78
+ { model: 'SM-S220i', emulation: 'EscPosMobile', portName1: 'BT:SMS220i', type: 1, ip: '', printMode: 'append' },
79
+ { model: 'SM-S230i', emulation: 'EscosMobile', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
80
+ { model: 'SM-T300i/T300', emulation: 'EscPosMobile', portName1: 'BT:SMT300i/T300', type: 1, ip: '', printMode: 'append' },
81
+ { model: 'SM-T400i', emulation: 'EscosMobile', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
82
+ { model: 'SM-L200', emulation: 'StarPRNT', portName1: 'BT:SML200', type: 1, ip: '', printMode: 'append' },
83
+ { model: 'SM-L300', emulation: 'StarPRNT', portName1: 'BT:SML300', type: 1, ip: '', printMode: 'append' },
84
+ { model: 'BSC10', emulation: 'EscPos', portName1: 'BT:BSC10', type: 1, ip: '', printMode: 'append' },
85
+ { model: 'SM-S210i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS210i', type: 1, ip: '', printMode: 'append' },
86
+ { model: 'SM-S220i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS220i', type: 1, ip: '', printMode: 'append' },
87
+ { model: 'SM-S230i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
88
+ { model: 'SM-T300i/T300 StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT300i', type: 1, ip: '', printMode: 'append' },
89
+ { model: 'SM-T400i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
90
+ ]
91
+
92
+ const handleClick = async (item: any, type?: number, ip?: string) => {
93
+ let _item = item
94
+ if (_item) {
95
+ _item = {
96
+ ...currentPrinter,
97
+ ...item,
98
+ type: type ?? currentPrinter?.type,
99
+ ip: ip ?? currentPrinter?.ip ?? '',
100
+ portName: (type ?? currentPrinter?.type) === 1 || !ip
101
+ ? item.portName1 ?? currentPrinter?.portName1
102
+ : `TCP:${ip}`
103
+ }
104
+ }
105
+ setCurrentPrinter(_item)
106
+ await _setStoreData('printer', _item)
107
+ type === 1 && onClose && onClose()
108
+ }
109
+
110
+ const onLayout = (event: any, type: string) => {
111
+ const { width } = event.nativeEvent.layout;
112
+ setLayoutWidth({ ...layoutWidth, [type]: width })
113
+ };
114
+
115
+ const onSubmit = ({ ip }: any) => {
116
+ handleClick(currentPrinter, 2, ip)
117
+ onClose && onClose()
118
+ }
119
+
120
+ const handleAutoPrint = async () => {
121
+ setAutoPrintEnabled(!autoPrintEnabled)
122
+ await _setStoreData('auto_print_after_accept_order', !autoPrintEnabled)
123
+ }
124
+
125
+ useEffect(() => {
126
+ const getStorageData = async () => {
127
+ const printer = await _retrieveStoreData('printer')
128
+ const autoPrint = await _retrieveStoreData('auto_print_after_accept_order')
129
+ setCurrentPrinter(printer)
130
+ setAutoPrintEnabled(!!autoPrint)
131
+ }
132
+
133
+ getStorageData()
134
+ }, [])
135
+
136
+ useEffect(() => {
137
+ currentPrinter?.ip && !isErrorIp && setValue('ip', currentPrinter?.ip)
138
+ }, [currentPrinter?.type])
139
+
140
+ return (
141
+ <ScrollView
142
+ showsVerticalScrollIndicator={false}
143
+ >
144
+ <OText size={24} style={{ paddingLeft: 30 }}>
145
+ {t('PRINTER_SETTINGS', 'Printer Settings')}
146
+ </OText>
147
+ <EnabledAutoPrint>
148
+ <View style={{ flex: 1 }}>
149
+ <OText
150
+ numberOfLines={2}
151
+ adjustsFontSizeToFit
152
+ style={{ ...styles.label, paddingHorizontal: 0 }}>
153
+ {t('AUTO_PRINT_AFTER_ACCEPTING_ORDER', 'Auto print after accepting order')}
154
+ </OText>
155
+ </View>
156
+ <ToggleSwitch
157
+ isOn={autoPrintEnabled}
158
+ onColor={theme.colors.primary}
159
+ offColor={theme.colors.offColor}
160
+ size="small"
161
+ onToggle={() => handleAutoPrint()}
162
+ animationSpeed={200}
163
+ />
164
+ </EnabledAutoPrint>
165
+ <View style={{ paddingHorizontal: 30 }}>
166
+ {printerList.map((item: any, i: number) => (
167
+ <Container
168
+ key={i}
169
+ activeOpacity={1}
170
+ onPress={() => handleClick(item)}
171
+ >
172
+ <View style={styles.wrapperContainer}>
173
+ <View style={{ flexDirection: 'row' }}>
174
+ <TouchableOpacity
175
+ activeOpacity={1}
176
+ style={styles.wIconContainer}
177
+ onPress={() => handleClick(item)}
178
+ >
179
+ <SimpleLineIcons
180
+ name='printer'
181
+ color={theme.colors.textGray}
182
+ size={18}
183
+ style={{ ...styles.icons, color: currentPrinter?.model === item.model ? theme.colors.primary : theme.colors.textGray }}
184
+ />
185
+ <OText
186
+ size={18}
187
+ color={currentPrinter?.model === item.model ? theme.colors.primary : theme.colors.textGray}
188
+ >
189
+ {item.model}
190
+ </OText>
191
+ </TouchableOpacity>
192
+ {currentPrinter?.model === item.model && (
193
+ <TouchableOpacity
194
+ activeOpacity={1}
195
+ onPress={() => handleClick(null)}
196
+ style={{ width: 40 }}
197
+ >
198
+ <FeatherIcon
199
+ name='x-circle'
200
+ color={theme.colors.danger500}
201
+ size={20}
202
+ style={styles.icons}
203
+ />
204
+ </TouchableOpacity>
205
+ )}
206
+ </View>
207
+ <View
208
+ style={styles.wrapperIcons}
209
+ >
210
+ <View style={styles.wrapperIcons} onLayout={(e) => onLayout(e, 'actionsBtns')}>
211
+ <FAIcons
212
+ name='bluetooth'
213
+ size={20}
214
+ {...(currentPrinter?.type === 1 && currentPrinter?.model === item.model ? { color: theme.colors.primary } : {})}
215
+ style={{ ...styles.optionIcons, borderColor: currentPrinter?.type === 1 && currentPrinter?.model === item.model ? theme.colors.primary : theme.colors.textGray }}
216
+ onPress={() => handleClick(item, 1)}
217
+ />
218
+ <MCIcons
219
+ name='access-point-network'
220
+ size={20}
221
+ {...(currentPrinter?.type === 2 && currentPrinter?.model === item.model ? { color: theme.colors.primary } : {})}
222
+ style={{ ...styles.optionIcons, borderColor: currentPrinter?.type === 2 && currentPrinter?.model === item.model ? theme.colors.primary : theme.colors.textGray }}
223
+ onPress={() => handleClick(item, 2)}
224
+ />
225
+ </View>
226
+ {currentPrinter?.type === 2 && currentPrinter?.model === item.model && (
227
+ <View style={{ flexDirection: 'row', width: WIDTH_SCREEN - 60 - layoutWidth.actionsBtns }}>
228
+ <Controller
229
+ control={control}
230
+ name={'ip'}
231
+ rules={{
232
+ required: t('VALIDATION_ERROR_IP_ADDRESS_REQUIRED', 'Ip address is required'),
233
+ pattern: {
234
+ value: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i,
235
+ message: t('INVALID_ERROR_IP_ADDRESS', 'Invalid ip address')
236
+ }
237
+ }}
238
+ defaultValue={currentPrinter?.ip ?? ''}
239
+ render={() => (
240
+ <OInput
241
+ placeholder={t('IP_ADDRESS', 'Ip address')}
242
+ placeholderTextColor={theme.colors.arrowColor}
243
+ style={{ ...styles.inputStyle, borderColor: isErrorIp ? theme.colors.danger500 : theme.colors.tabBar }}
244
+ value={currentPrinter?.ip ?? ''}
245
+ selectionColor={theme.colors.primary}
246
+ color={theme.colors.textGray}
247
+ onChange={(value: any) => {
248
+ setValue('ip', value)
249
+ setCurrentPrinter({
250
+ ...currentPrinter,
251
+ ip: value
252
+ })
253
+ }}
254
+ />
255
+ )}
256
+ />
257
+ <TouchableOpacity
258
+ activeOpacity={1}
259
+ disabled={isErrorIp}
260
+ onPress={handleSubmit(onSubmit)}
261
+ style={{ width: 40 }}
262
+ >
263
+ <FeatherIcon
264
+ name='save'
265
+ size={20}
266
+ color={isErrorIp ? theme.colors.tabBar : theme.colors.primary }
267
+ style={styles.icons}
268
+ />
269
+ </TouchableOpacity>
270
+ </View>
271
+ )}
272
+ </View>
273
+ </View>
274
+ </Container>
275
+ ))}
276
+ </View>
277
+ </ScrollView>
278
+ )
279
+ }
@@ -0,0 +1,17 @@
1
+ import styled from "styled-components/native";
2
+
3
+ export const Container = styled.View`
4
+ flex-direction: row;
5
+ justify-content: space-between;
6
+ width: 100%;
7
+ padding: 5px 5px 5px 0;
8
+ border-bottom-width: 1px;
9
+ border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
10
+ `
11
+
12
+ export const EnabledAutoPrint = styled.View`
13
+ flex-direction: row;
14
+ justify-content: space-between;
15
+ align-items: center;
16
+ padding: 20px 30px 10px;
17
+ `;
@@ -72,7 +72,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
72
72
 
73
73
  const getProductPrice = (product: any) => {
74
74
  let subOptionPrice = 0;
75
- if (product?.options?.length > 0 && product?.options?.suboptions?.length > 0) {
75
+ if (product?.options?.length > 0 && product?.options[0]?.suboptions?.length > 0) {
76
76
  for (const option of product?.options) {
77
77
  for (const suboption of option?.suboptions) {
78
78
  subOptionPrice += suboption.quantity * suboption.price;
@@ -118,7 +118,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
118
118
 
119
119
  const onTextLayout = useCallback((e: any) => {
120
120
  setLengthMore((e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2); //to check the text is more than 2 lines or not
121
- },[]);
121
+ }, []);
122
122
 
123
123
  return (
124
124
  <AccordionSection>
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  import React, { useState, useEffect, useRef } from 'react'
2
4
  import {
3
5
  useLanguage,
@@ -16,6 +16,7 @@ export const SearchBar = (props: any) => {
16
16
  isCancelXButtonShow,
17
17
  noBorderShow,
18
18
  borderStyle,
19
+ containerStyle
19
20
  } = props;
20
21
 
21
22
  const [, t] = useLanguage();
@@ -67,7 +68,7 @@ export const SearchBar = (props: any) => {
67
68
  });
68
69
 
69
70
  return (
70
- <View style={[styles.container]}>
71
+ <View style={{ ...styles.container, ...containerStyle}}>
71
72
  <OInput
72
73
  forwardRef={inputRef}
73
74
  value={searchValue}