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,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 BilStripe from '@meronex/icons/bi/BilStripe'
4
5
  import { Button, Input, IconButton } from '../../../styles'
@@ -41,6 +42,8 @@ export const PaymethodOptionStripeConnect = (props) => {
41
42
  handleDeletePaymethod
42
43
  } = props
43
44
 
45
+ const history = useHistory()
46
+ const query = new URLSearchParams(useLocation().search)
44
47
  const theme = useTheme()
45
48
  const [, t] = useLanguage()
46
49
  const { width } = useWindowSize()
@@ -120,6 +123,25 @@ export const PaymethodOptionStripeConnect = (props) => {
120
123
  if (Object.keys(changes).length > 0) setLocalState(JSON.parse(JSON.stringify(changes)))
121
124
  }, [changesState?.sites, changesState?.allowed_order_types])
122
125
 
126
+ const handleTabClick = (tab, isInitialRender) => {
127
+ setPaymentTabs(tab)
128
+ if (!isInitialRender) {
129
+ const businessId = query.get('id')
130
+ const section = query.get('section')
131
+ const paymethod = query.get('paymethod')
132
+ history.replace(`${location.pathname}?id=${businessId}&section=${section}&paymethod=${paymethod}&payemthod_tab=${tab}`)
133
+ }
134
+ }
135
+
136
+ useEffect(() => {
137
+ const payemthodTab = query.get('payemthod_tab')
138
+ if (payemthodTab) {
139
+ handleTabClick(Number(payemthodTab), true)
140
+ } else {
141
+ handleTabClick(0)
142
+ }
143
+ }, [])
144
+
123
145
  return (
124
146
  <>
125
147
  <Container id='stripe_connect'>
@@ -151,21 +173,21 @@ export const PaymethodOptionStripeConnect = (props) => {
151
173
  <TabsContainer>
152
174
  <Tab
153
175
  active={paymentTabs === 0}
154
- onClick={() => setPaymentTabs(0)}
176
+ onClick={() => handleTabClick(0)}
155
177
  >
156
178
  {t('GENERAL', 'General')}
157
179
  </Tab>
158
180
  {sitesState?.sites?.length > 0 && (
159
181
  <Tab
160
182
  active={paymentTabs === 1}
161
- onClick={() => setPaymentTabs(1)}
183
+ onClick={() => handleTabClick(1)}
162
184
  >
163
185
  {t('CHANNELS', 'Channels')}
164
186
  </Tab>
165
187
  )}
166
188
  <Tab
167
189
  active={paymentTabs === 2}
168
- onClick={() => setPaymentTabs(2)}
190
+ onClick={() => handleTabClick(2)}
169
191
  >
170
192
  {t('ORDER_TYPE', 'Order type')}
171
193
  </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 PaymethodOptionStripeRedirect = (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 PaymethodOptionStripeRedirect = (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_redirect'>
@@ -156,21 +178,21 @@ export const PaymethodOptionStripeRedirect = (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 { ProductDetatils as ProductDetatilsController } from 'ordering-components-admin-external'
3
4
  import { useWindowSize } from '../../../hooks/useWindowSize'
4
5
  import { MoreSidebarLayout, Personalization } from '../../Shared'
@@ -38,22 +39,32 @@ const ProductDetailsUI = (props) => {
38
39
  handleChangeRibbon,
39
40
  cleanFormState
40
41
  } = props
42
+ const history = useHistory()
43
+ const query = new URLSearchParams(useLocation().search)
41
44
  const { width } = useWindowSize()
42
45
  const [isMenuOpen, setIsMenuOpen] = useState(false)
43
46
  const [extraOpen, setExtraOpen] = useState(false)
44
47
  const [isExtendExtraOpen, setIsExtendExtraOpen] = useState(false)
45
48
  const [showOption, setShowOption] = useState(null)
46
49
 
47
- const handleShowOption = (option) => {
50
+ const handleShowOption = (option, isInitialRender) => {
48
51
  setIsExtendExtraOpen(false)
49
52
  setShowOption(option)
50
53
  setExtraOpen(true)
54
+ if (!isInitialRender) {
55
+ const category = query.get('category')
56
+ const product = query.get('product')
57
+ history.replace(`${location.pathname}?category=${category}&product=${product}&section=${option}`)
58
+ }
51
59
  }
52
60
 
53
61
  const handleCloseExtraOpen = () => {
54
62
  setIsExtendExtraOpen(false)
55
63
  setExtraOpen(false)
56
64
  setShowOption(null)
65
+ const category = query.get('category')
66
+ const product = query.get('product')
67
+ history.replace(`${location.pathname}?category=${category}&product=${product}`)
57
68
  }
58
69
 
59
70
  const actionSidebar = (value) => {
@@ -115,6 +126,13 @@ const ProductDetailsUI = (props) => {
115
126
  return () => document.removeEventListener('keydown', onCloseSidebar)
116
127
  }, [open])
117
128
 
129
+ useEffect(() => {
130
+ const section = query.get('section')
131
+ if (section) {
132
+ handleShowOption(section, true)
133
+ }
134
+ }, [])
135
+
118
136
  return (
119
137
  <Container id='product_details'>
120
138
  {(!isExtendExtraOpen || width < 1000) && (
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect, useRef } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, ProductExtras as ProductExtrasController } from 'ordering-components-admin-external'
3
4
  import { useWindowSize } from '../../../hooks/useWindowSize'
4
5
  import { Button, Checkbox } from '../../../styles'
@@ -42,6 +43,8 @@ const ProductExtrasUI = (props) => {
42
43
  handleDragEnd,
43
44
  handleUpdateExtraState
44
45
  } = props
46
+ const history = useHistory()
47
+ const query = new URLSearchParams(useLocation().search)
45
48
  const theme = useTheme()
46
49
  const [, t] = useLanguage()
47
50
  const { width } = useWindowSize()
@@ -54,17 +57,27 @@ const ProductExtrasUI = (props) => {
54
57
  const [extraIds, setExtraIds] = useState([])
55
58
  const [isCheckboxClicked, setIsCheckboxClicked] = useState(false)
56
59
 
57
- const handleOpenExtraDetails = (e, extra) => {
58
- if (e.target.closest('.extra-checkbox') || e.target.closest('.draggable-dots')) return
60
+ const handleOpenExtraDetails = (e, extra, isInitialRender) => {
61
+ if (e?.target?.closest('.extra-checkbox') || e?.target?.closest('.draggable-dots')) return
59
62
  setIsExtendExtraOpen(true)
60
63
  setCurrentExtra(extra)
61
64
  setOpenExtraDetails(true)
65
+ if (!isInitialRender) {
66
+ const category = query.get('category')
67
+ const product = query.get('product')
68
+ const section = query.get('section')
69
+ history.replace(`${location.pathname}?category=${category}&product=${product}&section=${section}&extra=${extra.id}`)
70
+ }
62
71
  }
63
72
 
64
73
  const handleCloseExtraDetails = () => {
65
74
  setOpenExtraDetails(false)
66
75
  setIsExtendExtraOpen(false)
67
76
  setCurrentExtra(null)
77
+ const category = query.get('category')
78
+ const product = query.get('product')
79
+ const section = query.get('section')
80
+ history.replace(`${location.pathname}?category=${category}&product=${product}&section=${section}`)
68
81
  }
69
82
 
70
83
  const addExtraListener = (e) => {
@@ -112,6 +125,14 @@ const ProductExtrasUI = (props) => {
112
125
  }
113
126
  }, [productState, extrasState])
114
127
 
128
+ useEffect(() => {
129
+ const extraId = query.get('extra')
130
+ if (extraId) {
131
+ const initExtra = extrasState?.extras.find(extra => extra.id === Number(extraId))
132
+ initExtra && handleOpenExtraDetails(null, initExtra, true)
133
+ }
134
+ }, [])
135
+
115
136
  return (
116
137
  <MainContainer>
117
138
  <ProductExtrasContainer>
@@ -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 { useWindowSize } from '../../../hooks/useWindowSize'
4
5
  import { Button } from '../../../styles'
@@ -20,23 +21,43 @@ export const ProductIngredient = (props) => {
20
21
  setIsExtendExtraOpen
21
22
  } = props
22
23
 
24
+ const history = useHistory()
25
+ const query = new URLSearchParams(useLocation().search)
23
26
  const [, t] = useLanguage()
24
27
  const { width } = useWindowSize()
25
28
  const [openDetails, setOpenDetails] = useState(false)
26
29
  const [currentIngredient, setCurrentIngredient] = useState(null)
27
30
 
28
- const handleOpenIngredient = (ingredient) => {
31
+ const handleOpenIngredient = (ingredient, isInitialRender) => {
29
32
  setCurrentIngredient(ingredient)
30
33
  setIsExtendExtraOpen(true)
31
34
  setOpenDetails(true)
35
+ if (!isInitialRender) {
36
+ const category = query.get('category')
37
+ const product = query.get('product')
38
+ const section = query.get('section')
39
+ history.replace(`${location.pathname}?category=${category}&product=${product}&section=${section}&ingredient=${ingredient.id}`)
40
+ }
32
41
  }
33
42
 
34
43
  const handleCloseDetails = () => {
35
44
  setOpenDetails(false)
36
45
  setIsExtendExtraOpen(false)
37
46
  setCurrentIngredient(null)
47
+ const category = query.get('category')
48
+ const product = query.get('product')
49
+ const section = query.get('section')
50
+ history.replace(`${location.pathname}?category=${category}&product=${product}&section=${section}`)
38
51
  }
39
52
 
53
+ useEffect(() => {
54
+ const ingredientId = query.get('ingredient')
55
+ if (ingredientId) {
56
+ const initIngredient = product.ingredients.find(ingredient => ingredient.id === Number(ingredientId))
57
+ initIngredient && handleOpenIngredient(initIngredient, true)
58
+ }
59
+ }, [])
60
+
40
61
  return (
41
62
  <MainContainer>
42
63
  <IngredientContainer>
@@ -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 { DragScroll } from '../../Shared'
4
5
  import { SeoOptions } from '../SeoOptions'
@@ -33,6 +34,8 @@ export const ProductMainDetails = (props) => {
33
34
  setFees,
34
35
  cleanFormState
35
36
  } = props
37
+ const history = useHistory()
38
+ const query = new URLSearchParams(useLocation().search)
36
39
  const [, t] = useLanguage()
37
40
 
38
41
  const [selectedOption, setSelectedOption] = useState('information')
@@ -42,11 +45,26 @@ export const ProductMainDetails = (props) => {
42
45
  { key: 'labels', content: t('LABELS', 'Labels') },
43
46
  { key: 'seo_options', content: t('SEO_OPTIONS', 'SEO options') }
44
47
  ]
45
- const handleSelectOption = (tab) => {
48
+ const handleSelectOption = (tab, isInitialRender) => {
46
49
  setSelectedOption(tab)
47
50
  setIsExtendExtraOpen(false)
51
+ if (!isInitialRender) {
52
+ const category = query.get('category')
53
+ const product = query.get('product')
54
+ const section = query.get('section')
55
+ history.replace(`${location.pathname}?category=${category}&product=${product}&section=${section}&tab=${tab}`)
56
+ }
48
57
  }
49
58
 
59
+ useEffect(() => {
60
+ const tab = query.get('tab')
61
+ if (tab) {
62
+ handleSelectOption(tab, true)
63
+ } else {
64
+ handleSelectOption(selectedOption)
65
+ }
66
+ }, [])
67
+
50
68
  return (
51
69
  <Container maxLimit={isExtendExtraOpen}>
52
70
  <h1>{t('PRODUCT_DETAILS', 'Product details')}</h1>
@@ -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, ProductTagsList as ProductTagsController } from 'ordering-components-admin-external'
3
4
  import Skeleton from 'react-loading-skeleton'
4
5
  import { SearchBar, SideBar } from '../../Shared'
@@ -32,25 +33,49 @@ const ProductTagsListUI = (props) => {
32
33
  handleSelectAllTags
33
34
  } = props
34
35
 
36
+ const history = useHistory()
37
+ const query = new URLSearchParams(useLocation().search)
35
38
  const [, t] = useLanguage()
36
39
  const [selectedTag, setSelectedTag] = useState(null)
37
40
  const [isOpenTagDetail, setIsOpenTagDetail] = useState(false)
38
41
 
39
- const handleOpenProductTagDetail = (e, tag) => {
40
- const isInvalid = e.target.closest('.product-tag-checkbox')
42
+ const handleOpenProductTagDetail = (e, tag, isInitialRender) => {
43
+ const isInvalid = e?.target?.closest('.product-tag-checkbox')
41
44
  if (isInvalid) return
42
45
 
43
46
  setSelectedTag(tag)
44
47
  setIsExtendExtraOpen(true)
45
48
  setIsOpenTagDetail(true)
49
+
50
+ if (!isInitialRender) {
51
+ const category = query.get('category')
52
+ const product = query.get('product')
53
+ const section = query.get('section')
54
+ const tab = query.get('tab')
55
+ history.replace(`${location.pathname}?category=${category}&product=${product}&section=${section}&tab=${tab}&tag=${tag.id}`)
56
+ }
46
57
  }
47
58
 
48
59
  const handleCloseDetail = () => {
49
60
  setIsOpenTagDetail(false)
50
61
  setIsExtendExtraOpen(false)
51
62
  setSelectedTag(null)
63
+ const category = query.get('category')
64
+ const product = query.get('product')
65
+ const section = query.get('section')
66
+ const tab = query.get('tab')
67
+ history.replace(`${location.pathname}?category=${category}&product=${product}&section=${section}&tab=${tab}`)
52
68
  }
53
69
 
70
+ useEffect(() => {
71
+ if (tagsState.loading) return
72
+ const tagId = query.get('tag')
73
+ if (tagId) {
74
+ const initTag = tagsState.tags.find(tag => tag.id === Number(tagId))
75
+ handleOpenProductTagDetail(null, initTag, true)
76
+ }
77
+ }, [tagsState.loading])
78
+
54
79
  return (
55
80
  <>
56
81
  <TagsListContainer>
@@ -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, UserWallet as UserWalletController } from 'ordering-components-admin-external'
3
4
  import { CustomerCashWalletDetails } from '../CustomerCashWalletDetails'
4
5
  import { CustomerWalletEvents } from '../CustomerWalletEvents'
@@ -10,22 +11,43 @@ import {
10
11
  } from './styles'
11
12
 
12
13
  const CustomerCashWalletUI = (props) => {
14
+ const history = useHistory()
15
+ const query = new URLSearchParams(useLocation().search)
13
16
  const [, t] = useLanguage()
14
17
  const [showOption, setShowOption] = useState('cash_wallet')
15
18
 
19
+ const handleTabClick = (tab, isInitialRender) => {
20
+ setShowOption(tab)
21
+ if (!isInitialRender) {
22
+ const enabled = query.get('enabled')
23
+ const id = query.get('id')
24
+ const section = query.get('section')
25
+ history.replace(`${location.pathname}?enabled=${enabled}&id=${id}&section=${section}&tab=${tab}`)
26
+ }
27
+ }
28
+
29
+ useEffect(() => {
30
+ const tab = query.get('tab')
31
+ if (tab) {
32
+ handleTabClick(tab, true)
33
+ } else {
34
+ handleTabClick(showOption)
35
+ }
36
+ }, [])
37
+
16
38
  return (
17
39
  <Container>
18
40
  <h1>{t('CASH_WALLET', 'Cash wallet')}</h1>
19
41
  <Tabs>
20
42
  <Tab
21
43
  active={showOption === 'cash_wallet'}
22
- onClick={() => setShowOption('cash_wallet')}
44
+ onClick={() => handleTabClick('cash_wallet')}
23
45
  >
24
46
  {t('CASH_WALLET', 'Cash wallet')}
25
47
  </Tab>
26
48
  <Tab
27
49
  active={showOption === 'history'}
28
- onClick={() => setShowOption('history')}
50
+ onClick={() => handleTabClick('history')}
29
51
  >
30
52
  {t('TRANSACTION_HISTORY', 'Transaction history')}
31
53
  </Tab>
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import {
3
4
  UserDetails as UserDetailsController,
4
5
  useLanguage,
@@ -37,6 +38,8 @@ const CustomerDetailsUI = (props) => {
37
38
  handleChangeActiveUser
38
39
  } = props
39
40
 
41
+ const history = useHistory()
42
+ const query = new URLSearchParams(useLocation().search)
40
43
  const theme = useTheme()
41
44
  const [, t] = useLanguage()
42
45
  const [{ optimizeImage }] = useUtils()
@@ -67,10 +70,15 @@ const CustomerDetailsUI = (props) => {
67
70
  })
68
71
  }
69
72
 
70
- const handleClickMenu = (key) => {
73
+ const handleClickMenu = (key, isInitialRender) => {
71
74
  setShowOption(key)
72
75
  handleParentSidebarMove(500)
73
76
  setIsOpenMenu(true)
77
+ if (!isInitialRender) {
78
+ const enabled = query.get('enabled')
79
+ const id = query.get('id')
80
+ history.replace(`${location.pathname}?enabled=${enabled}&id=${id}&section=${key}`)
81
+ }
74
82
  }
75
83
 
76
84
  const handleCloseMenu = () => {
@@ -78,6 +86,9 @@ const CustomerDetailsUI = (props) => {
78
86
  setShowOption(null)
79
87
  setIsOpenMenu(false)
80
88
  setMenuMoveDistance(0)
89
+ const enabled = query.get('enabled')
90
+ const id = query.get('id')
91
+ history.replace(`${location.pathname}?eanbled=${enabled}&id=${id}`)
81
92
  }
82
93
 
83
94
  const expandSidebar = () => {
@@ -97,6 +108,14 @@ const CustomerDetailsUI = (props) => {
97
108
  if (isOpenMenu) setIsExpand(false)
98
109
  }, [isOpenMenu])
99
110
 
111
+ useEffect(() => {
112
+ if (userState.loading) return
113
+ const section = query.get('section')
114
+ if (section) {
115
+ handleClickMenu(section, true)
116
+ }
117
+ }, [userState.loading])
118
+
100
119
  return (
101
120
  <>
102
121
  <DetailsContainer>
@@ -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, UserWallet as UserWalletController } from 'ordering-components-admin-external'
3
4
  import { useTheme } from 'styled-components'
4
5
  import Skeleton from 'react-loading-skeleton'
@@ -19,23 +20,44 @@ const CustomerPointsWalletUI = (props) => {
19
20
  user
20
21
  } = props
21
22
 
23
+ const history = useHistory()
24
+ const query = new URLSearchParams(useLocation().search)
22
25
  const [, t] = useLanguage()
23
26
  const theme = useTheme()
24
27
  const [showOption, setShowOption] = useState('points_wallet')
25
28
 
29
+ const handleTabClick = (tab, isInitialRender) => {
30
+ setShowOption(tab)
31
+ if (!isInitialRender) {
32
+ const enabled = query.get('enabled')
33
+ const id = query.get('id')
34
+ const section = query.get('section')
35
+ history.replace(`${location.pathname}?enabled=${enabled}&id=${id}&section=${section}&tab=${tab}`)
36
+ }
37
+ }
38
+
39
+ useEffect(() => {
40
+ const tab = query.get('tab')
41
+ if (tab) {
42
+ handleTabClick(tab, true)
43
+ } else {
44
+ handleTabClick(showOption)
45
+ }
46
+ }, [])
47
+
26
48
  return (
27
49
  <Container>
28
50
  <h1>{t('POINTS_WALLET', 'Points wallet')}</h1>
29
51
  <Tabs>
30
52
  <Tab
31
53
  active={showOption === 'points_wallet'}
32
- onClick={() => setShowOption('points_wallet')}
54
+ onClick={() => handleTabClick('points_wallet')}
33
55
  >
34
56
  {t('POINTS_WALLET', 'Points wallet')}
35
57
  </Tab>
36
58
  <Tab
37
59
  active={showOption === 'history'}
38
- onClick={() => setShowOption('history')}
60
+ onClick={() => handleTabClick('history')}
39
61
  >
40
62
  {t('TRANSACTION_HISTORY', 'Transaction history')}
41
63
  </Tab>
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useLocation } from 'react-router-dom'
2
+ import { useHistory, useLocation } from 'react-router-dom'
3
3
  import {
4
4
  UsersList as UsersListController,
5
5
  useLanguage
@@ -44,7 +44,6 @@ const CustomersListingUI = (props) => {
44
44
  handleSelectedUsers,
45
45
  deleteUsersActionState,
46
46
  handleDeleteSeveralUsers,
47
- onUserRedirect,
48
47
  handleSuccessUpdate,
49
48
  handleSuccessAddUser,
50
49
  handleSuccessDeleteUser,
@@ -56,6 +55,7 @@ const CustomersListingUI = (props) => {
56
55
  } = props
57
56
 
58
57
  const [, t] = useLanguage()
58
+ const history = useHistory()
59
59
  const query = new URLSearchParams(useLocation().search)
60
60
  const [queryId, setQueryId] = useState(null)
61
61
  const [isOpenUserDetails, setIsOpenUserDetails] = useState(false)
@@ -74,11 +74,13 @@ const CustomersListingUI = (props) => {
74
74
  setOpenUser(null)
75
75
  setQueryId(null)
76
76
  moveDistance && setMoveDistance(0)
77
- onUserRedirect()
77
+ const enabled = selectedUserActiveState ? 'active' : 'inactive'
78
+ history.replace(`${location.pathname}?enabled=${enabled}`)
78
79
  }
79
80
 
80
81
  const handleOpenUserDetails = (user) => {
81
- onUserRedirect(user?.id)
82
+ const enabled = selectedUserActiveState ? 'active' : 'inactive'
83
+ history.replace(`${location.pathname}?enabled=${enabled}&id=${user?.id}`)
82
84
  setOpenUser(user)
83
85
  setOpenUserAddForm(false)
84
86
  setIsOpenUserDetails(true)
@@ -218,8 +220,11 @@ const CustomersListingUI = (props) => {
218
220
  }
219
221
 
220
222
  export const CustomersListing = (props) => {
223
+ const query = new URLSearchParams(useLocation().search)
224
+ const defaultUserActiveState = query.get('enabled') !== 'inactive'
221
225
  const customersProps = {
222
226
  ...props,
227
+ defaultUserActiveState,
223
228
  UIComponent: CustomersListingUI,
224
229
  isSearchByUserEmail: true,
225
230
  isSearchByUserPhone: true,
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import Skeleton from 'react-loading-skeleton'
3
4
  import { ThreeDots, Calendar4Event, ArrowsAngleContract, ArrowsAngleExpand } from 'react-bootstrap-icons'
4
5
  import { Dropdown, DropdownButton } from 'react-bootstrap'
@@ -34,6 +35,8 @@ export const ProfessionalDetailUI = (props) => {
34
35
  actionStatus
35
36
  } = props
36
37
 
38
+ const history = useHistory()
39
+ const query = new URLSearchParams(useLocation().search)
37
40
  const theme = useTheme()
38
41
  const [adminUserState] = useSession()
39
42
  const [, t] = useLanguage()
@@ -86,6 +89,29 @@ export const ProfessionalDetailUI = (props) => {
86
89
  }
87
90
  }, [actionStatus.error])
88
91
 
92
+ const handleTabClick = (tab, isInitialRender) => {
93
+ setCurrentMenuSelected(tab)
94
+ if (!isInitialRender) {
95
+ const id = query.get('id')
96
+ const enabled = query.get('enabled')
97
+ const section = query.get('section')
98
+ if (section) {
99
+ history.replace(`${location.pathname}?enabled=${enabled}&id=${id}&section=${section}&tab=${tab}`)
100
+ } else {
101
+ history.replace(`${location.pathname}?enabled=${enabled}&id=${id}&tab=${tab}`)
102
+ }
103
+ }
104
+ }
105
+
106
+ useEffect(() => {
107
+ const tab = query.get('tab')
108
+ if (tab) {
109
+ handleTabClick(tab, true)
110
+ } else {
111
+ handleTabClick(currentMenuSelected)
112
+ }
113
+ }, [])
114
+
89
115
  return (
90
116
  <>
91
117
  <DetailsHeader>
@@ -153,7 +179,7 @@ export const ProfessionalDetailUI = (props) => {
153
179
  </DetailsHeader>
154
180
  <UserDetailsMenu
155
181
  currentMenuSelected={currentMenuSelected}
156
- handleChangeMenu={setCurrentMenuSelected}
182
+ handleChangeMenu={handleTabClick}
157
183
  isProfessional
158
184
  />
159
185
  {!userState?.loading && userState?.user && (