ordering-ui-admin-external 1.14.3 → 1.15.1

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 (268) hide show
  1. package/_bundles/{ordering-ui-admin.e2a58dcc95d6a983dfc0.js → ordering-ui-admin.7c0f4e22698e5dbd9b25.js} +2 -2
  2. package/_modules/components/BusinessIntelligence/BusinessReviewDetails/index.js +5 -5
  3. package/_modules/components/BusinessIntelligence/BusinessReviewList/index.js +29 -4
  4. package/_modules/components/BusinessIntelligence/InvoiceBusinessManager/index.js +16 -1
  5. package/_modules/components/BusinessIntelligence/InvoiceDriverManager/index.js +16 -1
  6. package/_modules/components/BusinessIntelligence/InvoiceManager/index.js +14 -1
  7. package/_modules/components/BusinessIntelligence/InvoiceOrdertype/styles.js +1 -1
  8. package/_modules/components/BusinessIntelligence/ProductReviewDetails/index.js +4 -3
  9. package/_modules/components/BusinessIntelligence/Reports/index.js +14 -1
  10. package/_modules/components/BusinessIntelligence/ReviewProductsListing/index.js +52 -16
  11. package/_modules/components/BusinessIntelligence/ReviewsListing/index.js +32 -4
  12. package/_modules/components/BusinessIntelligence/UserReviewDetails/index.js +4 -3
  13. package/_modules/components/BusinessIntelligence/UsersReviewList/index.js +35 -10
  14. package/_modules/components/CartRecovery/RecoveryActionDetail/index.js +21 -2
  15. package/_modules/components/CartRecovery/RecoveryActionListing/index.js +22 -2
  16. package/_modules/components/Delivery/DeliveryUsersListing/index.js +2 -0
  17. package/_modules/components/Delivery/DriversCompaniesListing/index.js +36 -13
  18. package/_modules/components/Delivery/DriversCompanyDetailsForm/index.js +31 -6
  19. package/_modules/components/Delivery/DriversGroupDetails/index.js +29 -2
  20. package/_modules/components/Delivery/DriversGroupLogistics/index.js +16 -2
  21. package/_modules/components/Delivery/DriversGroupsListing/index.js +28 -11
  22. package/_modules/components/Delivery/UserDetails/index.js +24 -1
  23. package/_modules/components/Loyalty/GiftCardDetail/styles.js +68 -0
  24. package/_modules/components/Loyalty/GiftCards/index.js +23 -2
  25. package/_modules/components/Loyalty/PointsWalletBusinessList/index.js +26 -1
  26. package/_modules/components/Loyalty/PointsWalletLevels/index.js +22 -1
  27. package/_modules/components/Loyalty/RewardsPrograms/index.js +34 -4
  28. package/_modules/components/Loyalty/Wallet/index.js +20 -1
  29. package/_modules/components/Marketing/AdBannersListing/index.js +24 -5
  30. package/_modules/components/Marketing/BannerImageDetails/index.js +2 -1
  31. package/_modules/components/Marketing/CampaignDetail/index.js +19 -1
  32. package/_modules/components/Marketing/CampaignEmail/styles.js +5 -3
  33. package/_modules/components/Marketing/CampaignListing/index.js +19 -0
  34. package/_modules/components/Marketing/CampaignNotification/styles.js +5 -3
  35. package/_modules/components/Marketing/CampaignSMS/styles.js +5 -3
  36. package/_modules/components/Marketing/EnterprisePromotionGeneralDetails/index.js +2 -1
  37. package/_modules/components/Marketing/EnterprisePromotionListing/index.js +24 -4
  38. package/_modules/components/Marketing/PageBanner/index.js +27 -3
  39. package/_modules/components/Messages/MessagesListing/index.js +18 -1
  40. package/_modules/components/MyProducts/AdvancedSettings/FontStyleGroup.js +85 -0
  41. package/_modules/components/MyProducts/AdvancedSettings/OrderType.js +45 -0
  42. package/_modules/components/MyProducts/AdvancedSettings/SettingComponent.js +91 -0
  43. package/_modules/components/MyProducts/AdvancedSettings/index.js +626 -0
  44. package/_modules/components/MyProducts/AdvancedSettings/styles.js +146 -0
  45. package/_modules/components/MyProducts/AppLayout/index.js +9 -1
  46. package/_modules/components/MyProducts/AppLayout/styles.js +20 -3
  47. package/_modules/components/MyProducts/CallCenterApp/index.js +1 -1
  48. package/_modules/components/MyProducts/CustomerApp/index.js +2 -2
  49. package/_modules/components/MyProducts/DriverApp/index.js +2 -2
  50. package/_modules/components/MyProducts/KioskApp/index.js +1 -1
  51. package/_modules/components/MyProducts/OrderingWebsite/index.js +37 -6
  52. package/_modules/components/MyProducts/OrderingWebsite/styles.js +39 -5
  53. package/_modules/components/MyProducts/PosApp/index.js +1 -1
  54. package/_modules/components/MyProducts/StoreApp/index.js +2 -2
  55. package/_modules/components/OrderingProducts/OrderingProductDetails/index.js +21 -1
  56. package/_modules/components/OrderingProducts/OrderingProductsListing/index.js +18 -1
  57. package/_modules/components/Orders/DeliveriesManager/index.js +0 -1
  58. package/_modules/components/Orders/Messages/index.js +32 -29
  59. package/_modules/components/Orders/OrderDetails/index.js +38 -22
  60. package/_modules/components/Orders/OrderDetailsHeader/index.js +2 -3
  61. package/_modules/components/Orders/OrdersContentHeader/index.js +2 -2
  62. package/_modules/components/Orders/OrdersFilterGroup/index.js +112 -9
  63. package/_modules/components/Orders/OrdersFilterGroup/styles.js +11 -3
  64. package/_modules/components/Orders/OrdersManager/index.js +0 -1
  65. package/_modules/components/Settings/CountriesList/index.js +27 -4
  66. package/_modules/components/Settings/Deliverect/index.js +23 -2
  67. package/_modules/components/Settings/DoordashConnect/index.js +23 -2
  68. package/_modules/components/Settings/DropdownOptionList/index.js +27 -4
  69. package/_modules/components/Settings/IntegrationListing/index.js +3 -3
  70. package/_modules/components/Settings/ItsaCheckmate/index.js +23 -2
  71. package/_modules/components/Settings/LalamoveConnect/index.js +23 -2
  72. package/_modules/components/Settings/PickerExpress/index.js +23 -2
  73. package/_modules/components/Settings/PlaceListing/index.js +40 -4
  74. package/_modules/components/Settings/Settings/index.js +86 -45
  75. package/_modules/components/Settings/SettingsDetail/index.js +14 -1
  76. package/_modules/components/Settings/SitesAuthSettings/index.js +17 -1
  77. package/_modules/components/SidebarMenu/index.js +0 -1
  78. package/_modules/components/Stores/BusinessAdd/BusinessDetails/index.js +4 -9
  79. package/_modules/components/Stores/BusinessAdd/BusinessDetails/styles.js +3 -1
  80. package/_modules/components/Stores/BusinessAdd/DeliveryZone/index.js +13 -4
  81. package/_modules/components/Stores/BusinessAdd/DeliveryZone/styles.js +16 -10
  82. package/_modules/components/Stores/BusinessAdd/PaymentMethods/index.js +11 -3
  83. package/_modules/components/Stores/BusinessAdd/PaymentMethods/styles.js +3 -1
  84. package/_modules/components/Stores/BusinessAdd/ReceiveOrders/index.js +17 -6
  85. package/_modules/components/Stores/BusinessAdd/ReceiveOrders/styles.js +3 -1
  86. package/_modules/components/Stores/BusinessAdd/index.js +38 -8
  87. package/_modules/components/Stores/BusinessAdd/styles.js +8 -4
  88. package/_modules/components/Stores/BusinessAddStore/index.js +1 -1
  89. package/_modules/components/Stores/BusinessBrandListing/index.js +37 -4
  90. package/_modules/components/Stores/BusinessDeliveryPickupMore/index.js +20 -1
  91. package/_modules/components/Stores/BusinessDeliveryZoneDetails/index.js +22 -1
  92. package/_modules/components/Stores/BusinessDeliveryZoneList/index.js +32 -4
  93. package/_modules/components/Stores/BusinessDetail/index.js +18 -1
  94. package/_modules/components/Stores/BusinessDetails/index.js +17 -1
  95. package/_modules/components/Stores/BusinessFrontLayout/index.js +8 -1
  96. package/_modules/components/Stores/BusinessFrontLayout/styles.js +5 -3
  97. package/_modules/components/Stores/BusinessMenu/index.js +58 -7
  98. package/_modules/components/Stores/BusinessMenuOptions/index.js +24 -3
  99. package/_modules/components/Stores/BusinessOrderingChannels/index.js +18 -2
  100. package/_modules/components/Stores/BusinessPaymentMethods/index.js +26 -2
  101. package/_modules/components/Stores/BusinessPlaceGroupList/index.js +183 -0
  102. package/_modules/components/Stores/BusinessPlaceGroupList/styles.js +66 -0
  103. package/_modules/components/Stores/BusinessProductsCategoyDetails/index.js +21 -1
  104. package/_modules/components/Stores/BusinessProductsListing/index.js +74 -22
  105. package/_modules/components/Stores/BusinessPromotionGeneralForm/index.js +2 -2
  106. package/_modules/components/Stores/BusinessSharedMenuProducts/index.js +29 -2
  107. package/_modules/components/Stores/BusinessSync/index.js +16 -1
  108. package/_modules/components/Stores/BusinessTypes/index.js +27 -4
  109. package/_modules/components/Stores/BusinessWalletsList/index.js +24 -1
  110. package/_modules/components/Stores/BusinessesListing/index.js +9 -1
  111. package/_modules/components/Stores/ImportersButton/index.js +19 -6
  112. package/_modules/components/Stores/PaymentOption/index.js +29 -9
  113. package/_modules/components/Stores/PaymentOptionMethods/index.js +23 -3
  114. package/_modules/components/Stores/PaymentOptionPaypal/index.js +23 -3
  115. package/_modules/components/Stores/PaymentOptionSquare/index.js +23 -3
  116. package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +23 -3
  117. package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +23 -3
  118. package/_modules/components/Stores/PaymethodOptionStripeConnect/index.js +23 -3
  119. package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +23 -3
  120. package/_modules/components/Stores/ProductDetails/index.js +18 -1
  121. package/_modules/components/Stores/ProductExtras/index.js +25 -2
  122. package/_modules/components/Stores/ProductIngredient/index.js +23 -1
  123. package/_modules/components/Stores/ProductMainDetails/index.js +18 -1
  124. package/_modules/components/Stores/ProductTagsList/index.js +28 -2
  125. package/_modules/components/Users/CustomerCashWallet/index.js +22 -2
  126. package/_modules/components/Users/CustomerDetails/index.js +19 -1
  127. package/_modules/components/Users/CustomerPointsWallet/index.js +22 -2
  128. package/_modules/components/Users/CustomersListing/index.js +8 -3
  129. package/_modules/components/Users/ProfessionalDetail/index.js +25 -1
  130. package/_modules/components/Users/ProfessionalListing/index.js +8 -3
  131. package/_modules/components/Users/UserActiveStateFilter/index.js +18 -4
  132. package/_modules/components/Users/UserDetails/index.js +27 -1
  133. package/_modules/components/Users/UsersListing/index.js +8 -3
  134. package/package.json +2 -2
  135. package/src/components/BusinessIntelligence/BusinessReviewDetails/index.js +4 -4
  136. package/src/components/BusinessIntelligence/BusinessReviewList/index.js +29 -6
  137. package/src/components/BusinessIntelligence/InvoiceBusinessManager/index.js +17 -1
  138. package/src/components/BusinessIntelligence/InvoiceDriverManager/index.js +17 -1
  139. package/src/components/BusinessIntelligence/InvoiceManager/index.js +16 -2
  140. package/src/components/BusinessIntelligence/InvoiceOrdertype/styles.js +1 -0
  141. package/src/components/BusinessIntelligence/ProductReviewDetails/index.js +4 -4
  142. package/src/components/BusinessIntelligence/Reports/index.js +16 -2
  143. package/src/components/BusinessIntelligence/ReviewProductsListing/index.js +34 -6
  144. package/src/components/BusinessIntelligence/ReviewsListing/index.js +31 -5
  145. package/src/components/BusinessIntelligence/UserReviewDetails/index.js +4 -4
  146. package/src/components/BusinessIntelligence/UsersReviewList/index.js +32 -11
  147. package/src/components/CartRecovery/RecoveryActionDetail/index.js +19 -1
  148. package/src/components/CartRecovery/RecoveryActionListing/index.js +21 -3
  149. package/src/components/Delivery/DeliveryUsersListing/index.js +3 -1
  150. package/src/components/Delivery/DriversCompaniesListing/index.js +27 -9
  151. package/src/components/Delivery/DriversCompanyDetailsForm/index.js +37 -8
  152. package/src/components/Delivery/DriversGroupDetails/index.js +36 -4
  153. package/src/components/Delivery/DriversGroupLogistics/index.js +18 -2
  154. package/src/components/Delivery/DriversGroupsListing/index.js +20 -6
  155. package/src/components/Delivery/UserDetails/index.js +26 -1
  156. package/src/components/Loyalty/GiftCardDetail/styles.js +192 -0
  157. package/src/components/Loyalty/GiftCards/index.js +22 -2
  158. package/src/components/Loyalty/PointsWalletBusinessList/index.js +24 -1
  159. package/src/components/Loyalty/PointsWalletLevels/index.js +21 -1
  160. package/src/components/Loyalty/RewardsPrograms/index.js +30 -3
  161. package/src/components/Loyalty/Wallet/index.js +22 -1
  162. package/src/components/Marketing/AdBannersListing/index.js +25 -8
  163. package/src/components/Marketing/BannerImageDetails/index.js +2 -1
  164. package/src/components/Marketing/CampaignDetail/index.js +22 -1
  165. package/src/components/Marketing/CampaignEmail/styles.js +3 -0
  166. package/src/components/Marketing/CampaignListing/index.js +18 -1
  167. package/src/components/Marketing/CampaignNotification/styles.js +3 -0
  168. package/src/components/Marketing/CampaignSMS/styles.js +3 -0
  169. package/src/components/Marketing/EnterprisePromotionGeneralDetails/index.js +2 -1
  170. package/src/components/Marketing/EnterprisePromotionListing/index.js +19 -1
  171. package/src/components/Marketing/PageBanner/index.js +26 -3
  172. package/src/components/Messages/MessagesListing/index.js +17 -0
  173. package/src/components/MyProducts/AdvancedSettings/FontStyleGroup.js +64 -0
  174. package/src/components/MyProducts/AdvancedSettings/OrderType.js +40 -0
  175. package/src/components/MyProducts/AdvancedSettings/SettingComponent.js +104 -0
  176. package/src/components/MyProducts/AdvancedSettings/index.js +541 -0
  177. package/src/components/MyProducts/AdvancedSettings/styles.js +388 -0
  178. package/src/components/MyProducts/AppLayout/index.js +19 -2
  179. package/src/components/MyProducts/AppLayout/styles.js +65 -0
  180. package/src/components/MyProducts/CallCenterApp/index.js +1 -1
  181. package/src/components/MyProducts/CustomerApp/index.js +2 -2
  182. package/src/components/MyProducts/DriverApp/index.js +2 -2
  183. package/src/components/MyProducts/KioskApp/index.js +1 -1
  184. package/src/components/MyProducts/OrderingWebsite/index.js +309 -255
  185. package/src/components/MyProducts/OrderingWebsite/styles.js +99 -2
  186. package/src/components/MyProducts/PosApp/index.js +1 -1
  187. package/src/components/MyProducts/StoreApp/index.js +2 -2
  188. package/src/components/OrderingProducts/OrderingProductDetails/index.js +24 -2
  189. package/src/components/OrderingProducts/OrderingProductsListing/index.js +17 -1
  190. package/src/components/Orders/DeliveriesManager/index.js +0 -1
  191. package/src/components/Orders/Messages/index.js +31 -11
  192. package/src/components/Orders/OrderDetails/index.js +34 -20
  193. package/src/components/Orders/OrderDetailsHeader/index.js +2 -3
  194. package/src/components/Orders/OrdersContentHeader/index.js +1 -1
  195. package/src/components/Orders/OrdersFilterGroup/index.js +111 -13
  196. package/src/components/Orders/OrdersFilterGroup/styles.js +26 -0
  197. package/src/components/Orders/OrdersManager/index.js +0 -1
  198. package/src/components/Settings/CountriesList/index.js +26 -6
  199. package/src/components/Settings/Deliverect/index.js +26 -2
  200. package/src/components/Settings/DoordashConnect/index.js +26 -2
  201. package/src/components/Settings/DropdownOptionList/index.js +27 -6
  202. package/src/components/Settings/IntegrationListing/index.js +3 -3
  203. package/src/components/Settings/ItsaCheckmate/index.js +26 -2
  204. package/src/components/Settings/LalamoveConnect/index.js +26 -2
  205. package/src/components/Settings/PickerExpress/index.js +26 -2
  206. package/src/components/Settings/PlaceListing/index.js +38 -6
  207. package/src/components/Settings/Settings/index.js +79 -37
  208. package/src/components/Settings/SettingsDetail/index.js +15 -1
  209. package/src/components/Settings/SitesAuthSettings/index.js +18 -1
  210. package/src/components/SidebarMenu/index.js +0 -2
  211. package/src/components/Stores/BusinessAdd/BusinessDetails/index.js +1 -10
  212. package/src/components/Stores/BusinessAdd/BusinessDetails/styles.js +4 -0
  213. package/src/components/Stores/BusinessAdd/DeliveryZone/index.js +120 -109
  214. package/src/components/Stores/BusinessAdd/DeliveryZone/styles.js +22 -1
  215. package/src/components/Stores/BusinessAdd/PaymentMethods/index.js +8 -2
  216. package/src/components/Stores/BusinessAdd/PaymentMethods/styles.js +4 -0
  217. package/src/components/Stores/BusinessAdd/ReceiveOrders/index.js +11 -6
  218. package/src/components/Stores/BusinessAdd/ReceiveOrders/styles.js +4 -0
  219. package/src/components/Stores/BusinessAdd/index.js +47 -16
  220. package/src/components/Stores/BusinessAdd/styles.js +27 -1
  221. package/src/components/Stores/BusinessAddStore/index.js +1 -1
  222. package/src/components/Stores/BusinessBrandListing/index.js +37 -4
  223. package/src/components/Stores/BusinessDeliveryPickupMore/index.js +22 -1
  224. package/src/components/Stores/BusinessDeliveryZoneDetails/index.js +25 -2
  225. package/src/components/Stores/BusinessDeliveryZoneList/index.js +30 -3
  226. package/src/components/Stores/BusinessDetail/index.js +20 -1
  227. package/src/components/Stores/BusinessDetails/index.js +18 -1
  228. package/src/components/Stores/BusinessFrontLayout/index.js +13 -1
  229. package/src/components/Stores/BusinessFrontLayout/styles.js +11 -0
  230. package/src/components/Stores/BusinessMenu/index.js +56 -11
  231. package/src/components/Stores/BusinessMenuOptions/index.js +28 -3
  232. package/src/components/Stores/BusinessOrderingChannels/index.js +19 -2
  233. package/src/components/Stores/BusinessPaymentMethods/index.js +24 -2
  234. package/src/components/Stores/BusinessPlaceGroupList/index.js +193 -0
  235. package/src/components/Stores/BusinessPlaceGroupList/styles.js +143 -0
  236. package/src/components/Stores/BusinessProductsCategoyDetails/index.js +21 -1
  237. package/src/components/Stores/BusinessProductsListing/index.js +49 -8
  238. package/src/components/Stores/BusinessPromotionGeneralForm/index.js +2 -2
  239. package/src/components/Stores/BusinessSharedMenuProducts/index.js +29 -3
  240. package/src/components/Stores/BusinessSync/index.js +18 -2
  241. package/src/components/Stores/BusinessTypes/index.js +26 -4
  242. package/src/components/Stores/BusinessWalletsList/index.js +23 -1
  243. package/src/components/Stores/BusinessesListing/index.js +11 -2
  244. package/src/components/Stores/ImportersButton/index.js +24 -3
  245. package/src/components/Stores/PaymentOption/index.js +29 -8
  246. package/src/components/Stores/PaymentOptionMethods/index.js +25 -3
  247. package/src/components/Stores/PaymentOptionPaypal/index.js +25 -3
  248. package/src/components/Stores/PaymentOptionSquare/index.js +25 -3
  249. package/src/components/Stores/PaymentOptionStripeDirect/index.js +25 -3
  250. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +25 -3
  251. package/src/components/Stores/PaymethodOptionStripeConnect/index.js +25 -3
  252. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +25 -3
  253. package/src/components/Stores/ProductDetails/index.js +19 -1
  254. package/src/components/Stores/ProductExtras/index.js +23 -2
  255. package/src/components/Stores/ProductIngredient/index.js +23 -2
  256. package/src/components/Stores/ProductMainDetails/index.js +20 -2
  257. package/src/components/Stores/ProductTagsList/index.js +28 -3
  258. package/src/components/Users/CustomerCashWallet/index.js +25 -3
  259. package/src/components/Users/CustomerDetails/index.js +20 -1
  260. package/src/components/Users/CustomerPointsWallet/index.js +25 -3
  261. package/src/components/Users/CustomersListing/index.js +9 -4
  262. package/src/components/Users/ProfessionalDetail/index.js +27 -1
  263. package/src/components/Users/ProfessionalListing/index.js +9 -4
  264. package/src/components/Users/UserActiveStateFilter/index.js +16 -3
  265. package/src/components/Users/UserDetails/index.js +27 -1
  266. package/src/components/Users/UsersListing/index.js +9 -4
  267. package/template/pages/BusinessProductsList/index.js +1 -1
  268. /package/_bundles/{ordering-ui-admin.e2a58dcc95d6a983dfc0.js.LICENSE.txt → ordering-ui-admin.7c0f4e22698e5dbd9b25.js.LICENSE.txt} +0 -0
@@ -1,5 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useLanguage } from 'ordering-components-admin-external'
3
+ import { useHistory, useLocation } from 'react-router-dom'
3
4
  import { Alert, SearchBar, Modal, SideBar } from '../../Shared'
4
5
  import { ChevronRight, Square, CheckSquareFill } from 'react-bootstrap-icons'
5
6
  import { useWindowSize } from '../../../hooks/useWindowSize'
@@ -31,6 +32,8 @@ export const BusinessTypes = (props) => {
31
32
  setIsExtendExtraOpen
32
33
  } = props
33
34
 
35
+ const history = useHistory()
36
+ const query = new URLSearchParams(useLocation().search)
34
37
  const [, t] = useLanguage()
35
38
  const { width } = useWindowSize()
36
39
 
@@ -41,19 +44,28 @@ export const BusinessTypes = (props) => {
41
44
  const [selectedBusinessType, setSelectedBusinessType] = useState(null)
42
45
  const [isOpenTypeDetail, setIsOpenTypeDetail] = useState(false)
43
46
 
44
- const handleOpenBusinessTypeDetail = (e, category) => {
45
- const isInvalid = e.target.closest('.business-type-checkbox')
47
+ const handleOpenBusinessTypeDetail = (category, e) => {
48
+ const isInvalid = e?.target?.closest('.business-type-checkbox')
46
49
  if (isInvalid) return
47
50
 
48
51
  setSelectedBusinessType(category)
49
52
  setIsExtendExtraOpen(true)
50
53
  setIsOpenTypeDetail(true)
54
+
55
+ const businessId = query.get('id')
56
+ const section = query.get('section')
57
+ const tab = query.get('tab')
58
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&tab=${tab}&business_type=${category.id}`)
51
59
  }
52
60
 
53
61
  const handleCloseDetail = () => {
54
62
  setIsOpenTypeDetail(false)
55
63
  setIsExtendExtraOpen(false)
56
64
  setSelectedBusinessType(null)
65
+ const businessId = query.get('id')
66
+ const section = query.get('section')
67
+ const tab = query.get('tab')
68
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&tab=${tab}`)
57
69
  }
58
70
 
59
71
  const handleSelectBusinessTypes = (typeId) => {
@@ -101,6 +113,16 @@ export const BusinessTypes = (props) => {
101
113
  setFilteredBusinessTypes([...updatedBusinessTypes])
102
114
  }, [businessTypes, searchVal])
103
115
 
116
+ useEffect(() => {
117
+ const businessTypeId = query.get('business_type')
118
+ if (businessTypeId) {
119
+ const initBusinessType = businessTypes.find(type => type.id === Number(businessTypeId))
120
+ setTimeout(() => {
121
+ handleOpenBusinessTypeDetail(initBusinessType)
122
+ }, 500)
123
+ }
124
+ }, [])
125
+
104
126
  return (
105
127
  <Container>
106
128
  <SearchWrapper>
@@ -118,7 +140,7 @@ export const BusinessTypes = (props) => {
118
140
  <BusinessTypeContainer
119
141
  key={category?.id}
120
142
  active={selectedBusinessType?.id === category?.id}
121
- onClick={(evt) => handleOpenBusinessTypeDetail(evt, category)}
143
+ onClick={(evt) => handleOpenBusinessTypeDetail(category, evt)}
122
144
  >
123
145
  <BusinessTypeInfoWrapper>
124
146
  <CheckBoxWrapper
@@ -144,7 +166,7 @@ export const BusinessTypes = (props) => {
144
166
 
145
167
  <AddNewBusinessTypeContainer>
146
168
  <AddNewBusinessTypeTitle
147
- onClick={(evt) => handleOpenBusinessTypeDetail(evt, null)}
169
+ onClick={(evt) => handleOpenBusinessTypeDetail(null, evt)}
148
170
  >
149
171
  {t('ADD_NEW_BUSINESS_CATEGORY', 'Add new business category')}
150
172
  </AddNewBusinessTypeTitle>
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, useConfig, BusinessWalletsList as BusinessWalletsListController } from 'ordering-components-admin-external'
3
4
  import Skeleton from 'react-loading-skeleton'
4
5
  import { ChevronRight } from 'react-bootstrap-icons'
@@ -24,6 +25,8 @@ const BusinessWalletsListUI = (props) => {
24
25
  handleUpdateWallet
25
26
  } = props
26
27
 
28
+ const history = useHistory()
29
+ const query = new URLSearchParams(useLocation().search)
27
30
  const [, t] = useLanguage()
28
31
  const [{ configs }] = useConfig()
29
32
  const [isOpenDetails, setIsOpenDetails] = useState(false)
@@ -42,18 +45,26 @@ const BusinessWalletsListUI = (props) => {
42
45
  wallet_credit_point_enabled: t('WALLET_CREDIT_POINT_ENABLED', 'Wallet credit point enabled')
43
46
  }
44
47
 
45
- const handleOpenWallet = (config) => {
48
+ const handleOpenWallet = (config, isInitialRender) => {
46
49
  setIsOpenWalletDetails(true)
47
50
  handleClosePaymethodDetails()
48
51
  setCurrentConfig(config)
49
52
  setIsExtendExtraOpen(true)
50
53
  setIsOpenDetails(true)
54
+ if (!isInitialRender) {
55
+ const businessId = query.get('id')
56
+ const section = query.get('section')
57
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&wallet=${config.id}`)
58
+ }
51
59
  }
52
60
  const handleCloseWallet = () => {
53
61
  setIsOpenWalletDetails(false)
54
62
  setIsOpenDetails(false)
55
63
  setIsExtendExtraOpen(false)
56
64
  setCurrentConfig(null)
65
+ const businessId = query.get('id')
66
+ const section = query.get('section')
67
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}`)
57
68
  }
58
69
 
59
70
  useEffect(() => {
@@ -71,6 +82,17 @@ const BusinessWalletsListUI = (props) => {
71
82
  setCurrentConfig(null)
72
83
  }, [isClose])
73
84
 
85
+ useEffect(() => {
86
+ if (loyaltyPlanState.loading || walletsListState.loading) return
87
+ const walletId = query.get('wallet')
88
+ if (walletId) {
89
+ const initWallet = walletsListState.wallets.find(wallet => wallet.id === Number(walletId))
90
+ if (initWallet) {
91
+ handleOpenWallet(initWallet, true)
92
+ }
93
+ }
94
+ }, [loyaltyPlanState.loading, walletsListState.loading])
95
+
74
96
  return (
75
97
  <>
76
98
  {(loyaltyPlanState.loading || walletsListState.loading) ? (
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect, useMemo } from 'react'
2
- import { useLocation } from 'react-router-dom'
2
+ import { useHistory, useLocation } from 'react-router-dom'
3
3
  import { useLanguage, useEvent, DashboardBusinessList as BusinessListController } from 'ordering-components-admin-external'
4
4
  import BsGrid from '@meronex/icons/bs/BsGrid'
5
5
  import BsViewList from '@meronex/icons/bs/BsViewList'
@@ -55,6 +55,7 @@ const BusinessesListingUI = (props) => {
55
55
  inActiveBusinesses
56
56
  } = props
57
57
 
58
+ const history = useHistory()
58
59
  const query = new URLSearchParams(useLocation().search)
59
60
  const theme = useTheme()
60
61
  const [, t] = useLanguage()
@@ -128,7 +129,6 @@ const BusinessesListingUI = (props) => {
128
129
  if (id === null) setOpenBusinessDetails(false)
129
130
  else {
130
131
  setDetailsBusinessId(id)
131
- onBusinessRedirect && onBusinessRedirect(id)
132
132
  setOpenBusinessDetails(true)
133
133
  }
134
134
  }, [])
@@ -162,17 +162,26 @@ const BusinessesListingUI = (props) => {
162
162
 
163
163
  const handleOpenSync = () => {
164
164
  setOpenSync(true)
165
+ history.replace(`${location.pathname}?header=sync`)
165
166
  }
166
167
 
167
168
  const handleCloseSync = () => {
168
169
  setMoveDistance(0)
169
170
  setOpenSync(false)
171
+ history.replace(`${location.pathname}`)
170
172
  }
171
173
 
172
174
  useEffect(() => {
173
175
  handleSetStorage()
174
176
  }, [])
175
177
 
178
+ useEffect(() => {
179
+ const header = query.get('header')
180
+ if (header === 'sync') {
181
+ setOpenSync(true)
182
+ }
183
+ }, [])
184
+
176
185
  return (
177
186
  <>
178
187
  <BusinessListingContainer isAdd={openAddBusiness}>
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import { Upload } from 'react-bootstrap-icons'
4
5
  import { Button } from '../../../styles'
@@ -7,17 +8,37 @@ import { SideBar } from '../../Shared'
7
8
  import { CsvImportButtonWrapper } from './styles'
8
9
 
9
10
  export const ImportersButton = (props) => {
11
+ const history = useHistory()
12
+ const query = new URLSearchParams(useLocation().search)
10
13
  const [, t] = useLanguage()
11
14
  const [openImporters, setOpenImporters] = useState(false)
12
15
  const [extraOpen, setExtraOpen] = useState(false)
13
16
 
17
+ const handleOpenImporters = () => {
18
+ setOpenImporters(true)
19
+
20
+ history.replace(`${location.pathname}?header=importers`)
21
+ }
22
+
23
+ const handleCloseImporters = () => {
24
+ setOpenImporters(false)
25
+ history.replace(`${location.pathname}`)
26
+ }
27
+
28
+ useEffect(() => {
29
+ const header = query.get('header')
30
+ if (header === 'importers') {
31
+ setOpenImporters(true)
32
+ }
33
+ }, [])
34
+
14
35
  return (
15
36
  <>
16
37
  <CsvImportButtonWrapper>
17
38
  <Button
18
39
  borderRadius='8px'
19
40
  color='lightPrimary'
20
- onClick={() => setOpenImporters(true)}
41
+ onClick={handleOpenImporters}
21
42
  >
22
43
  {t('IMPORTERS', 'Importers')}
23
44
  <Upload />
@@ -28,7 +49,7 @@ export const ImportersButton = (props) => {
28
49
  defaultSideBarWidth={extraOpen ? 1000 : 500}
29
50
  moveDistance={extraOpen ? 500 : 0}
30
51
  open={openImporters}
31
- onClose={() => setOpenImporters(false)}
52
+ onClose={handleCloseImporters}
32
53
  showExpandIcon
33
54
  >
34
55
  <ImportersListing
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
4
5
  import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
@@ -34,6 +35,8 @@ export const PaymentOption = (props) => {
34
35
  handleDeletePaymethod
35
36
  } = props
36
37
 
38
+ const history = useHistory()
39
+ const query = new URLSearchParams(useLocation().search)
37
40
  const theme = useTheme()
38
41
  const [, t] = useLanguage()
39
42
  const { width } = useWindowSize()
@@ -41,12 +44,11 @@ export const PaymentOption = (props) => {
41
44
  const [paymentTabs, setPaymentTabs] = useState(sitesState?.sites?.length > 0 ? 0 : 1)
42
45
  const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
43
46
  const [localState, setLocalState] = useState({ allowed_order_types: businessPaymethod?.allowed_order_types, sites: businessPaymethod?.sites })
44
- const filteredOptions = localState?.sites ?? businessPaymethod?.sites?.filter(a => sitesState?.sites?.find(b => a.id === b.id))
45
- const [all, setAll] = useState(!!!filteredOptions?.length)
47
+ const filteredOptions = localState?.sites ?? businessPaymethod?.sites.filter(a => sitesState?.sites?.find(b => a.id === b.id))
48
+ const [all, setAll] = useState(!filteredOptions?.length)
46
49
 
47
50
  const setPaymethodInfo = (values) => {
48
-
49
- let data = {}
51
+ const data = {}
50
52
  if (values?.value === 'All') {
51
53
  data[values.key] = []
52
54
  setAll(!all)
@@ -63,7 +65,7 @@ export const PaymentOption = (props) => {
63
65
 
64
66
  data[values.key] = array.length > 0 ? array : []
65
67
  if (values.key === 'sites') {
66
- setAll(!!!data?.sites?.length)
68
+ setAll(!data?.sites?.length)
67
69
  }
68
70
  }
69
71
  handleChangeBusinessPaymentState(data)
@@ -120,6 +122,25 @@ export const PaymentOption = (props) => {
120
122
  if (Object.keys(changes).length > 0) setLocalState(JSON.parse(JSON.stringify(changes)))
121
123
  }, [changesState?.allowed_order_types, changesState?.sites])
122
124
 
125
+ const handleTabClick = (tab, isInitialRender) => {
126
+ setPaymentTabs(tab)
127
+ if (!isInitialRender) {
128
+ const businessId = query.get('id')
129
+ const section = query.get('section')
130
+ const paymethod = query.get('paymethod')
131
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&paymethod=${paymethod}&payemthod_tab=${tab}`)
132
+ }
133
+ }
134
+
135
+ useEffect(() => {
136
+ const payemthodTab = query.get('payemthod_tab')
137
+ if (payemthodTab) {
138
+ handleTabClick(Number(payemthodTab), true)
139
+ } else {
140
+ handleTabClick(0)
141
+ }
142
+ }, [])
143
+
123
144
  return (
124
145
  <>
125
146
  <Container id='payment_method_option'>
@@ -152,14 +173,14 @@ export const PaymentOption = (props) => {
152
173
  {sitesState?.sites?.length > 0 && (
153
174
  <Tab
154
175
  active={paymentTabs === 0}
155
- onClick={() => setPaymentTabs(0)}
176
+ onClick={() => handleTabClick(0)}
156
177
  >
157
178
  {t('CHANNELS', 'Channels')}
158
179
  </Tab>
159
180
  )}
160
181
  <Tab
161
182
  active={paymentTabs === 1}
162
- onClick={() => setPaymentTabs(1)}
183
+ onClick={() => handleTabClick(1)}
163
184
  >
164
185
  {t('ORDER_TYPE', 'Order type')}
165
186
  </Tab>
@@ -167,7 +188,7 @@ export const PaymentOption = (props) => {
167
188
  {paymentTabs === 0 && sitesState?.sites?.length > 0 && (
168
189
  <>
169
190
  <TabOption
170
- key={'all'}
191
+ key='all'
171
192
  onClick={() => setPaymethodInfo({ key: 'sites', value: 'All' })}
172
193
  >
173
194
  {all ? (
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
4
5
  import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
@@ -40,6 +41,8 @@ export const PaymentOptionMethods = (props) => {
40
41
  title
41
42
  } = props
42
43
 
44
+ const history = useHistory()
45
+ const query = new URLSearchParams(useLocation().search)
43
46
  const theme = useTheme()
44
47
  const [, t] = useLanguage()
45
48
  const { width } = useWindowSize()
@@ -127,6 +130,25 @@ export const PaymentOptionMethods = (props) => {
127
130
  if (Object.keys(changes).length > 0) setLocalState(JSON.parse(JSON.stringify(changes)))
128
131
  }, [changesState?.sites, changesState?.allowed_order_types])
129
132
 
133
+ const handleTabClick = (tab, isInitialRender) => {
134
+ setPaymentTabs(tab)
135
+ if (!isInitialRender) {
136
+ const businessId = query.get('id')
137
+ const section = query.get('section')
138
+ const paymethod = query.get('paymethod')
139
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&paymethod=${paymethod}&payemthod_tab=${tab}`)
140
+ }
141
+ }
142
+
143
+ useEffect(() => {
144
+ const payemthodTab = query.get('payemthod_tab')
145
+ if (payemthodTab) {
146
+ handleTabClick(Number(payemthodTab), true)
147
+ } else {
148
+ handleTabClick(0)
149
+ }
150
+ }, [])
151
+
130
152
  return (
131
153
  <>
132
154
  <Container id={id}>
@@ -158,21 +180,21 @@ export const PaymentOptionMethods = (props) => {
158
180
  <TabsContainer>
159
181
  <Tab
160
182
  active={paymentTabs === 0}
161
- onClick={() => setPaymentTabs(0)}
183
+ onClick={() => handleTabClick(0)}
162
184
  >
163
185
  {t('GENERAL', 'General')}
164
186
  </Tab>
165
187
  {sitesState?.sites?.length > 0 && (
166
188
  <Tab
167
189
  active={paymentTabs === 1}
168
- onClick={() => setPaymentTabs(1)}
190
+ onClick={() => handleTabClick(1)}
169
191
  >
170
192
  {t('CHANNELS', 'Channels')}
171
193
  </Tab>
172
194
  )}
173
195
  <Tab
174
196
  active={paymentTabs === 2}
175
- onClick={() => setPaymentTabs(2)}
197
+ onClick={() => handleTabClick(2)}
176
198
  >
177
199
  {t('ORDER_TYPE', 'Order type')}
178
200
  </Tab>
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
4
5
  import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
@@ -38,6 +39,8 @@ export const PaymentOptionPaypal = (props) => {
38
39
  handleDeletePaymethod
39
40
  } = props
40
41
 
42
+ const history = useHistory()
43
+ const query = new URLSearchParams(useLocation().search)
41
44
  const theme = useTheme()
42
45
  const [, t] = useLanguage()
43
46
  const { width } = useWindowSize()
@@ -127,6 +130,25 @@ export const PaymentOptionPaypal = (props) => {
127
130
  if (Object.keys(changes).length > 0) setLocalState(JSON.parse(JSON.stringify(changes)))
128
131
  }, [changesState?.sites, changesState?.allowed_order_types])
129
132
 
133
+ const handleTabClick = (tab, isInitialRender) => {
134
+ setPaymentTabs(tab)
135
+ if (!isInitialRender) {
136
+ const businessId = query.get('id')
137
+ const section = query.get('section')
138
+ const paymethod = query.get('paymethod')
139
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&paymethod=${paymethod}&payemthod_tab=${tab}`)
140
+ }
141
+ }
142
+
143
+ useEffect(() => {
144
+ const payemthodTab = query.get('payemthod_tab')
145
+ if (payemthodTab) {
146
+ handleTabClick(Number(payemthodTab), true)
147
+ } else {
148
+ handleTabClick(0)
149
+ }
150
+ }, [])
151
+
130
152
  return (
131
153
  <>
132
154
  <Container id='paypal'>
@@ -158,21 +180,21 @@ export const PaymentOptionPaypal = (props) => {
158
180
  <TabsContainer>
159
181
  <Tab
160
182
  active={paymentTabs === 0}
161
- onClick={() => setPaymentTabs(0)}
183
+ onClick={() => handleTabClick(0)}
162
184
  >
163
185
  {t('GENERAL', 'General')}
164
186
  </Tab>
165
187
  {sitesState?.sites?.length > 0 && (
166
188
  <Tab
167
189
  active={paymentTabs === 1}
168
- onClick={() => setPaymentTabs(1)}
190
+ onClick={() => handleTabClick(1)}
169
191
  >
170
192
  {t('CHANNELS', 'Channels')}
171
193
  </Tab>
172
194
  )}
173
195
  <Tab
174
196
  active={paymentTabs === 2}
175
- onClick={() => setPaymentTabs(2)}
197
+ onClick={() => handleTabClick(2)}
176
198
  >
177
199
  {t('ORDER_TYPE', 'Order type')}
178
200
  </Tab>
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, PaymentOptionSquare as PaymentOptionSquareController } from 'ordering-components-admin-external'
3
4
  import { Button, IconButton, Input, Checkbox } from '../../../styles'
4
5
  import { useWindowSize } from '../../../hooks/useWindowSize'
@@ -43,6 +44,8 @@ const PaymentOptionSquareUI = (props) => {
43
44
  handleChangeSandbox
44
45
  } = props
45
46
 
47
+ const history = useHistory()
48
+ const query = new URLSearchParams(useLocation().search)
46
49
  const theme = useTheme()
47
50
  const [, t] = useLanguage()
48
51
  const { width } = useWindowSize()
@@ -109,6 +112,25 @@ const PaymentOptionSquareUI = (props) => {
109
112
  })
110
113
  }, [actionState?.error])
111
114
 
115
+ const handleTabClick = (tab, isInitialRender) => {
116
+ setPaymentTabs(tab)
117
+ if (!isInitialRender) {
118
+ const businessId = query.get('id')
119
+ const section = query.get('section')
120
+ const paymethod = query.get('paymethod')
121
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&paymethod=${paymethod}&payemthod_tab=${tab}`)
122
+ }
123
+ }
124
+
125
+ useEffect(() => {
126
+ const payemthodTab = query.get('payemthod_tab')
127
+ if (payemthodTab) {
128
+ handleTabClick(Number(payemthodTab), true)
129
+ } else {
130
+ handleTabClick(0)
131
+ }
132
+ }, [])
133
+
112
134
  return (
113
135
  <>
114
136
  <Container id='payment_method_square'>
@@ -140,21 +162,21 @@ const PaymentOptionSquareUI = (props) => {
140
162
  <TabsContainer>
141
163
  <Tab
142
164
  active={paymentTabs === 0}
143
- onClick={() => setPaymentTabs(0)}
165
+ onClick={() => handleTabClick(0)}
144
166
  >
145
167
  {t('GENERAL', 'General')}
146
168
  </Tab>
147
169
  {sitesState?.sites?.length > 0 && (
148
170
  <Tab
149
171
  active={paymentTabs === 1}
150
- onClick={() => setPaymentTabs(1)}
172
+ onClick={() => handleTabClick(1)}
151
173
  >
152
174
  {t('CHANNELS', 'Channels')}
153
175
  </Tab>
154
176
  )}
155
177
  <Tab
156
178
  active={paymentTabs === 2}
157
- onClick={() => setPaymentTabs(2)}
179
+ onClick={() => handleTabClick(2)}
158
180
  >
159
181
  {t('ORDER_TYPE', 'Order type')}
160
182
  </Tab>
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
4
5
  import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
@@ -38,6 +39,8 @@ export const PaymentOptionStripeDirect = (props) => {
38
39
  handleDeletePaymethod
39
40
  } = props
40
41
 
42
+ const history = useHistory()
43
+ const query = new URLSearchParams(useLocation().search)
41
44
  const theme = useTheme()
42
45
  const [, t] = useLanguage()
43
46
  const { width } = useWindowSize()
@@ -125,6 +128,25 @@ export const PaymentOptionStripeDirect = (props) => {
125
128
  if (Object.keys(changes).length > 0) setLocalState(JSON.parse(JSON.stringify(changes)))
126
129
  }, [changesState?.sites, changesState?.allowed_order_types])
127
130
 
131
+ const handleTabClick = (tab, isInitialRender) => {
132
+ setPaymentTabs(tab)
133
+ if (!isInitialRender) {
134
+ const businessId = query.get('id')
135
+ const section = query.get('section')
136
+ const paymethod = query.get('paymethod')
137
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&paymethod=${paymethod}&payemthod_tab=${tab}`)
138
+ }
139
+ }
140
+
141
+ useEffect(() => {
142
+ const payemthodTab = query.get('payemthod_tab')
143
+ if (payemthodTab) {
144
+ handleTabClick(Number(payemthodTab), true)
145
+ } else {
146
+ handleTabClick(0)
147
+ }
148
+ }, [])
149
+
128
150
  return (
129
151
  <>
130
152
  <Container id='stripe_direct'>
@@ -156,21 +178,21 @@ export const PaymentOptionStripeDirect = (props) => {
156
178
  <TabsContainer>
157
179
  <Tab
158
180
  active={paymentTabs === 0}
159
- onClick={() => setPaymentTabs(0)}
181
+ onClick={() => handleTabClick(0)}
160
182
  >
161
183
  {t('GENERAL', 'General')}
162
184
  </Tab>
163
185
  {sitesState?.sites?.length > 0 && (
164
186
  <Tab
165
187
  active={paymentTabs === 1}
166
- onClick={() => setPaymentTabs(1)}
188
+ onClick={() => handleTabClick(1)}
167
189
  >
168
190
  {t('CHANNELS', 'Channels')}
169
191
  </Tab>
170
192
  )}
171
193
  <Tab
172
194
  active={paymentTabs === 2}
173
- onClick={() => setPaymentTabs(2)}
195
+ onClick={() => handleTabClick(2)}
174
196
  >
175
197
  {t('ORDER_TYPE', 'Order type')}
176
198
  </Tab>
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
4
5
  import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
@@ -38,6 +39,8 @@ export const PaymethodOptionPaypalExpress = (props) => {
38
39
  handleDeletePaymethod
39
40
  } = props
40
41
 
42
+ const history = useHistory()
43
+ const query = new URLSearchParams(useLocation().search)
41
44
  const theme = useTheme()
42
45
  const [, t] = useLanguage()
43
46
  const { width } = useWindowSize()
@@ -121,6 +124,25 @@ export const PaymethodOptionPaypalExpress = (props) => {
121
124
  }
122
125
  }, [changesState?.sites, changesState?.allowed_order_types])
123
126
 
127
+ const handleTabClick = (tab, isInitialRender) => {
128
+ setPaymentTabs(tab)
129
+ if (!isInitialRender) {
130
+ const businessId = query.get('id')
131
+ const section = query.get('section')
132
+ const paymethod = query.get('paymethod')
133
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&paymethod=${paymethod}&payemthod_tab=${tab}`)
134
+ }
135
+ }
136
+
137
+ useEffect(() => {
138
+ const payemthodTab = query.get('payemthod_tab')
139
+ if (payemthodTab) {
140
+ handleTabClick(Number(payemthodTab), true)
141
+ } else {
142
+ handleTabClick(0)
143
+ }
144
+ }, [])
145
+
124
146
  return (
125
147
  <>
126
148
  <Container id='paypal_express'>
@@ -152,21 +174,21 @@ export const PaymethodOptionPaypalExpress = (props) => {
152
174
  <TabsContainer>
153
175
  <Tab
154
176
  active={paymentTabs === 0}
155
- onClick={() => setPaymentTabs(0)}
177
+ onClick={() => handleTabClick(0)}
156
178
  >
157
179
  {t('GENERAL', 'General')}
158
180
  </Tab>
159
181
  {sitesState?.sites?.length > 0 && (
160
182
  <Tab
161
183
  active={paymentTabs === 1}
162
- onClick={() => setPaymentTabs(1)}
184
+ onClick={() => handleTabClick(1)}
163
185
  >
164
186
  {t('CHANNELS', 'Channels')}
165
187
  </Tab>
166
188
  )}
167
189
  <Tab
168
190
  active={paymentTabs === 2}
169
- onClick={() => setPaymentTabs(2)}
191
+ onClick={() => handleTabClick(2)}
170
192
  >
171
193
  {t('ORDER_TYPE', 'Order type')}
172
194
  </Tab>