ordering-ui-admin-external 1.33.1 → 1.35.0

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 (293) hide show
  1. package/_bundles/{ordering-ui-admin.462f5c3aad7a320965e9.js → ordering-ui-admin.78f6259366a43cc634db.js} +2 -2
  2. package/_modules/components/BusinessIntelligence/AnalyticsCalendar/index.js +1 -0
  3. package/_modules/components/BusinessIntelligence/AnalyticsOrdersOrSales/index.js +40 -133
  4. package/_modules/components/BusinessIntelligence/BusinessReviewList/index.js +14 -6
  5. package/_modules/components/BusinessIntelligence/InvoiceBusinessManager/index.js +4 -3
  6. package/_modules/components/BusinessIntelligence/InvoiceDriverManager/index.js +4 -3
  7. package/_modules/components/BusinessIntelligence/InvoiceManager/index.js +5 -3
  8. package/_modules/components/BusinessIntelligence/Reports/ReportsSlaOrders/index.js +173 -0
  9. package/_modules/components/BusinessIntelligence/Reports/ReportsSlaOrders/styles.js +93 -0
  10. package/_modules/components/BusinessIntelligence/Reports/index.js +12 -4
  11. package/_modules/components/BusinessIntelligence/ReviewProductsListing/index.js +21 -10
  12. package/_modules/components/BusinessIntelligence/ReviewsListing/index.js +52 -12
  13. package/_modules/components/BusinessIntelligence/UsersReviewList/index.js +14 -6
  14. package/_modules/components/CartRecovery/OpenCartList/index.js +12 -3
  15. package/_modules/components/CartRecovery/OpenCartListing/index.js +16 -4
  16. package/_modules/components/CartRecovery/OpenCartsDetail/index.js +52 -2
  17. package/_modules/components/CartRecovery/OpenCartsDetail/styles.js +20 -3
  18. package/_modules/components/CartRecovery/RecoveryActionDetail/index.js +4 -3
  19. package/_modules/components/CartRecovery/RecoveryActionList/index.js +10 -1
  20. package/_modules/components/CartRecovery/RecoveryActionListing/index.js +15 -5
  21. package/_modules/components/Delivery/DeliveryUsersListing/index.js +19 -6
  22. package/_modules/components/Delivery/DriversCompaniesList/index.js +16 -3
  23. package/_modules/components/Delivery/DriversCompaniesListing/index.js +9 -5
  24. package/_modules/components/Delivery/DriversCompanyDetailsForm/index.js +4 -3
  25. package/_modules/components/Delivery/DriversGroupDetails/index.js +4 -3
  26. package/_modules/components/Delivery/DriversGroupLogistics/index.js +4 -4
  27. package/_modules/components/Delivery/DriversGroupsList/index.js +16 -3
  28. package/_modules/components/Delivery/DriversGroupsListing/index.js +9 -5
  29. package/_modules/components/Delivery/UserDetails/index.js +4 -8
  30. package/_modules/components/Delivery/UserFormDetails/index.js +9 -1
  31. package/_modules/components/Delivery/UsersList/index.js +10 -1
  32. package/_modules/components/Marketing/AdBannersListing/index.js +6 -3
  33. package/_modules/components/Marketing/CampaignDetail/index.js +4 -3
  34. package/_modules/components/Marketing/CampaignList/index.js +10 -1
  35. package/_modules/components/Marketing/CampaignListing/index.js +14 -4
  36. package/_modules/components/Marketing/EnterprisePromotionList/index.js +10 -1
  37. package/_modules/components/Marketing/EnterprisePromotionListing/index.js +14 -4
  38. package/_modules/components/Marketing/PageBanner/index.js +5 -5
  39. package/_modules/components/Messages/MessagesListing/index.js +15 -5
  40. package/_modules/components/MyProducts/AdvancedSettings/index.js +12 -0
  41. package/_modules/components/OrderingProducts/OrderingProductDetails/index.js +4 -2
  42. package/_modules/components/OrderingProducts/OrderingProductsListing/index.js +23 -5
  43. package/_modules/components/Orders/AllInOne/DriversManager/styles.js +1 -1
  44. package/_modules/components/Orders/AllInOne/index.js +7 -3
  45. package/_modules/components/Orders/AllInOne/styles.js +2 -2
  46. package/_modules/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +2 -16
  47. package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/index.js +26 -3
  48. package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +7 -2
  49. package/_modules/components/Orders/DeliveriesManager/index.js +4 -2
  50. package/_modules/components/Orders/DeliveryDashboard/index.js +4 -1
  51. package/_modules/components/Orders/DriverSelector/index.js +17 -5
  52. package/_modules/components/Orders/DriversDashboard/index.js +4 -2
  53. package/_modules/components/Orders/DriversLocation/index.js +70 -9
  54. package/_modules/components/Orders/DriversManager/index.js +5 -7
  55. package/_modules/components/Orders/DriversManager/styles.js +1 -1
  56. package/_modules/components/Orders/GiftCardsListing/index.js +46 -5
  57. package/_modules/components/Orders/Messages/index.js +4 -4
  58. package/_modules/components/Orders/OrderContactInformation/index.js +28 -20
  59. package/_modules/components/Orders/OrderDashboardSLASetting/index.js +1 -1
  60. package/_modules/components/Orders/OrderDetails/index.js +24 -13
  61. package/_modules/components/Orders/OrderStatusFilterBar/index.js +28 -5
  62. package/_modules/components/Orders/OrdersCards/index.js +10 -1
  63. package/_modules/components/Orders/OrdersDashboardControls/index.js +6 -2
  64. package/_modules/components/Orders/OrdersDashboardList/index.js +34 -4
  65. package/_modules/components/Orders/OrdersFilterGroup/styles.js +1 -1
  66. package/_modules/components/Orders/OrdersListing/index.js +6 -3
  67. package/_modules/components/Orders/OrdersManager/index.js +7 -2
  68. package/_modules/components/Orders/OrdersManager/styles.js +3 -3
  69. package/_modules/components/Orders/OrdersTable/index.js +9 -1
  70. package/_modules/components/Orders/OrdersTable/styles.js +1 -1
  71. package/_modules/components/Settings/Cms/index.js +14 -3
  72. package/_modules/components/Settings/LanguageManager/index.js +3 -1
  73. package/_modules/components/Settings/LanguageTransTable/index.js +14 -3
  74. package/_modules/components/Settings/SettingsList/index.js +1 -2
  75. package/_modules/components/Settings/WebhookDelaySelector/index.js +3 -0
  76. package/_modules/components/Settings/WebhookList/styles.js +1 -1
  77. package/_modules/components/Settings/WebhookListSelector/index.js +3 -0
  78. package/_modules/components/Shared/Pagination/index.js +1 -1
  79. package/_modules/components/Stores/BusinessActiveStateFilter/index.js +28 -5
  80. package/_modules/components/Stores/BusinessAdd/BusinessDetails/index.js +3 -2
  81. package/_modules/components/Stores/BusinessAdd/OrderTypePriceLevel/index.js +10 -5
  82. package/_modules/components/Stores/BusinessAdd/PaymentMethods/index.js +2 -1
  83. package/_modules/components/Stores/BusinessBrandListing/index.js +8 -5
  84. package/_modules/components/Stores/BusinessDeliveryPickupMore/index.js +4 -4
  85. package/_modules/components/Stores/BusinessDeliveryZoneDetails/index.js +4 -6
  86. package/_modules/components/Stores/BusinessDeliveryZoneList/index.js +5 -9
  87. package/_modules/components/Stores/BusinessDetail/index.js +4 -4
  88. package/_modules/components/Stores/BusinessDetails/index.js +5 -5
  89. package/_modules/components/Stores/BusinessDeviceListing/index.js +5 -4
  90. package/_modules/components/Stores/BusinessInformation/index.js +10 -6
  91. package/_modules/components/Stores/BusinessInformation/styles.js +1 -1
  92. package/_modules/components/Stores/BusinessMenu/index.js +8 -12
  93. package/_modules/components/Stores/BusinessMenuBasicOptions/index.js +8 -0
  94. package/_modules/components/Stores/BusinessMenuOptions/index.js +4 -6
  95. package/_modules/components/Stores/BusinessOrderingChannels/index.js +4 -4
  96. package/_modules/components/Stores/BusinessPaymentMethods/index.js +11 -7
  97. package/_modules/components/Stores/BusinessPlaceGroupList/index.js +5 -7
  98. package/_modules/components/Stores/BusinessPreorderDetails/index.js +13 -1
  99. package/_modules/components/Stores/BusinessProductList/index.js +1 -1
  100. package/_modules/components/Stores/BusinessProductsCategoyDetails/index.js +4 -3
  101. package/_modules/components/Stores/BusinessProductsListing/index.js +10 -6
  102. package/_modules/components/Stores/BusinessSharedMenuProducts/index.js +5 -11
  103. package/_modules/components/Stores/BusinessSync/index.js +4 -3
  104. package/_modules/components/Stores/BusinessTypes/index.js +5 -9
  105. package/_modules/components/Stores/BusinessWalletsList/index.js +5 -7
  106. package/_modules/components/Stores/BusinessWebhooks/index.js +12 -6
  107. package/_modules/components/Stores/BusinessesList/index.js +10 -1
  108. package/_modules/components/Stores/BusinessesListing/index.js +21 -6
  109. package/_modules/components/Stores/ImportersButton/index.js +5 -3
  110. package/_modules/components/Stores/PaymentOption/index.js +4 -5
  111. package/_modules/components/Stores/PaymentOptionMethods/index.js +4 -5
  112. package/_modules/components/Stores/PaymentOptionPaypal/index.js +4 -5
  113. package/_modules/components/Stores/PaymentOptionSquare/index.js +4 -5
  114. package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +4 -5
  115. package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +4 -5
  116. package/_modules/components/Stores/PaymethodOptionStripeConnect/index.js +4 -5
  117. package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +4 -5
  118. package/_modules/components/Stores/ProductDetails/index.js +5 -7
  119. package/_modules/components/Stores/ProductExtras/index.js +95 -23
  120. package/_modules/components/Stores/ProductExtras/styles.js +14 -8
  121. package/_modules/components/Stores/ProductIngredient/index.js +5 -9
  122. package/_modules/components/Stores/ProductMainDetails/index.js +4 -5
  123. package/_modules/components/Stores/ProductTagsList/index.js +5 -11
  124. package/_modules/components/Users/CustomerCashWallet/index.js +4 -5
  125. package/_modules/components/Users/CustomerDetails/index.js +21 -17
  126. package/_modules/components/Users/CustomerPointsWallet/index.js +4 -5
  127. package/_modules/components/Users/CustomersListing/index.js +17 -8
  128. package/_modules/components/Users/ProfessionalDetail/index.js +4 -9
  129. package/_modules/components/Users/ProfessionalList/index.js +10 -1
  130. package/_modules/components/Users/ProfessionalListing/index.js +17 -8
  131. package/_modules/components/Users/UserActiveStateFilter/index.js +7 -3
  132. package/_modules/components/Users/UserDetails/index.js +4 -9
  133. package/_modules/components/Users/UsersList/index.js +10 -1
  134. package/_modules/components/Users/UsersListing/index.js +17 -8
  135. package/_modules/index.js +12 -0
  136. package/_modules/utils/index.js +39 -2
  137. package/index-template.js +1 -1
  138. package/package.json +2 -2
  139. package/src/components/BusinessIntelligence/AnalyticsCalendar/index.js +4 -0
  140. package/src/components/BusinessIntelligence/AnalyticsOrdersOrSales/index.js +33 -123
  141. package/src/components/BusinessIntelligence/BusinessReviewList/index.js +13 -7
  142. package/src/components/BusinessIntelligence/InvoiceBusinessManager/index.js +3 -4
  143. package/src/components/BusinessIntelligence/InvoiceDriverManager/index.js +3 -4
  144. package/src/components/BusinessIntelligence/InvoiceManager/index.js +4 -4
  145. package/src/components/BusinessIntelligence/Reports/ReportsSlaOrders/index.js +200 -0
  146. package/src/components/BusinessIntelligence/Reports/ReportsSlaOrders/styles.js +239 -0
  147. package/src/components/BusinessIntelligence/Reports/index.js +10 -6
  148. package/src/components/BusinessIntelligence/ReviewProductsListing/index.js +23 -11
  149. package/src/components/BusinessIntelligence/ReviewsListing/index.js +54 -10
  150. package/src/components/BusinessIntelligence/UsersReviewList/index.js +14 -7
  151. package/src/components/CartRecovery/OpenCartList/index.js +15 -5
  152. package/src/components/CartRecovery/OpenCartListing/index.js +14 -3
  153. package/src/components/CartRecovery/OpenCartsDetail/index.js +44 -4
  154. package/src/components/CartRecovery/OpenCartsDetail/styles.js +54 -0
  155. package/src/components/CartRecovery/RecoveryActionDetail/index.js +3 -4
  156. package/src/components/CartRecovery/RecoveryActionList/index.js +12 -2
  157. package/src/components/CartRecovery/RecoveryActionListing/index.js +14 -6
  158. package/src/components/Delivery/DeliveryUsersListing/index.js +19 -8
  159. package/src/components/Delivery/DriversCompaniesList/index.js +17 -3
  160. package/src/components/Delivery/DriversCompaniesListing/index.js +7 -5
  161. package/src/components/Delivery/DriversCompanyDetailsForm/index.js +3 -4
  162. package/src/components/Delivery/DriversGroupDetails/index.js +3 -4
  163. package/src/components/Delivery/DriversGroupLogistics/index.js +3 -5
  164. package/src/components/Delivery/DriversGroupsList/index.js +17 -3
  165. package/src/components/Delivery/DriversGroupsListing/index.js +7 -5
  166. package/src/components/Delivery/UserDetails/index.js +4 -9
  167. package/src/components/Delivery/UserFormDetails/index.js +9 -0
  168. package/src/components/Delivery/UsersList/index.js +11 -1
  169. package/src/components/Marketing/AdBannersListing/index.js +5 -4
  170. package/src/components/Marketing/CampaignDetail/index.js +3 -4
  171. package/src/components/Marketing/CampaignList/index.js +12 -2
  172. package/src/components/Marketing/CampaignListing/index.js +14 -5
  173. package/src/components/Marketing/EnterprisePromotionList/index.js +11 -1
  174. package/src/components/Marketing/EnterprisePromotionListing/index.js +13 -5
  175. package/src/components/Marketing/PageBanner/index.js +5 -6
  176. package/src/components/Messages/MessagesListing/index.js +14 -5
  177. package/src/components/MyProducts/AdvancedSettings/index.js +4 -1
  178. package/src/components/OrderingProducts/OrderingProductDetails/index.js +4 -3
  179. package/src/components/OrderingProducts/OrderingProductsListing/index.js +23 -6
  180. package/src/components/Orders/AllInOne/DriversManager/styles.js +1 -1
  181. package/src/components/Orders/AllInOne/index.js +5 -1
  182. package/src/components/Orders/AllInOne/styles.js +6 -2
  183. package/src/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +4 -17
  184. package/src/components/Orders/CreateCustomOrder/SelectCustomer/index.js +23 -2
  185. package/src/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +22 -0
  186. package/src/components/Orders/DeliveriesManager/index.js +3 -1
  187. package/src/components/Orders/DeliveryDashboard/index.js +4 -1
  188. package/src/components/Orders/DriverSelector/index.js +8 -2
  189. package/src/components/Orders/DriversDashboard/index.js +3 -1
  190. package/src/components/Orders/DriversLocation/index.js +117 -43
  191. package/src/components/Orders/DriversManager/index.js +3 -2
  192. package/src/components/Orders/DriversManager/styles.js +1 -1
  193. package/src/components/Orders/GiftCardsListing/index.js +44 -5
  194. package/src/components/Orders/Messages/index.js +5 -5
  195. package/src/components/Orders/OrderContactInformation/index.js +13 -7
  196. package/src/components/Orders/OrderDashboardSLASetting/index.js +1 -1
  197. package/src/components/Orders/OrderDetails/index.js +16 -16
  198. package/src/components/Orders/OrderStatusFilterBar/index.js +19 -2
  199. package/src/components/Orders/OrdersCards/index.js +11 -1
  200. package/src/components/Orders/OrdersDashboardControls/index.js +8 -2
  201. package/src/components/Orders/OrdersDashboardList/index.js +34 -2
  202. package/src/components/Orders/OrdersFilterGroup/styles.js +1 -1
  203. package/src/components/Orders/OrdersListing/index.js +4 -1
  204. package/src/components/Orders/OrdersManager/index.js +6 -1
  205. package/src/components/Orders/OrdersManager/styles.js +4 -2
  206. package/src/components/Orders/OrdersTable/index.js +11 -2
  207. package/src/components/Orders/OrdersTable/styles.js +0 -6
  208. package/src/components/Settings/Cms/index.js +15 -2
  209. package/src/components/Settings/LanguageManager/index.js +5 -1
  210. package/src/components/Settings/LanguageTransTable/index.js +15 -2
  211. package/src/components/Settings/SettingsList/index.js +90 -94
  212. package/src/components/Settings/WebhookDelaySelector/index.js +3 -2
  213. package/src/components/Settings/WebhookList/styles.js +3 -0
  214. package/src/components/Settings/WebhookListSelector/index.js +1 -0
  215. package/src/components/Shared/Pagination/index.js +1 -1
  216. package/src/components/Stores/BusinessActiveStateFilter/index.js +24 -4
  217. package/src/components/Stores/BusinessAdd/BusinessDetails/index.js +1 -1
  218. package/src/components/Stores/BusinessAdd/OrderTypePriceLevel/index.js +9 -6
  219. package/src/components/Stores/BusinessAdd/PaymentMethods/index.js +1 -1
  220. package/src/components/Stores/BusinessBrandListing/index.js +6 -6
  221. package/src/components/Stores/BusinessDeliveryPickupMore/index.js +3 -5
  222. package/src/components/Stores/BusinessDeliveryZoneDetails/index.js +3 -7
  223. package/src/components/Stores/BusinessDeliveryZoneList/index.js +4 -11
  224. package/src/components/Stores/BusinessDetail/index.js +4 -5
  225. package/src/components/Stores/BusinessDetails/index.js +4 -6
  226. package/src/components/Stores/BusinessDeviceListing/index.js +4 -4
  227. package/src/components/Stores/BusinessInformation/index.js +8 -6
  228. package/src/components/Stores/BusinessInformation/styles.js +1 -0
  229. package/src/components/Stores/BusinessMenu/index.js +5 -13
  230. package/src/components/Stores/BusinessMenuBasicOptions/index.js +3 -2
  231. package/src/components/Stores/BusinessMenuOptions/index.js +3 -7
  232. package/src/components/Stores/BusinessOrderingChannels/index.js +3 -5
  233. package/src/components/Stores/BusinessPaymentMethods/index.js +7 -9
  234. package/src/components/Stores/BusinessPlaceGroupList/index.js +4 -8
  235. package/src/components/Stores/BusinessPreorderDetails/index.js +2 -2
  236. package/src/components/Stores/BusinessProductList/index.js +1 -1
  237. package/src/components/Stores/BusinessProductsCategoyDetails/index.js +3 -5
  238. package/src/components/Stores/BusinessProductsListing/index.js +9 -7
  239. package/src/components/Stores/BusinessSharedMenuProducts/index.js +4 -12
  240. package/src/components/Stores/BusinessSync/index.js +3 -4
  241. package/src/components/Stores/BusinessTypes/index.js +4 -11
  242. package/src/components/Stores/BusinessWalletsList/index.js +4 -8
  243. package/src/components/Stores/BusinessWebhooks/index.js +6 -4
  244. package/src/components/Stores/BusinessesList/index.js +11 -1
  245. package/src/components/Stores/BusinessesListing/index.js +21 -7
  246. package/src/components/Stores/ImportersButton/index.js +4 -5
  247. package/src/components/Stores/PaymentOption/index.js +3 -6
  248. package/src/components/Stores/PaymentOptionMethods/index.js +3 -6
  249. package/src/components/Stores/PaymentOptionPaypal/index.js +3 -6
  250. package/src/components/Stores/PaymentOptionSquare/index.js +3 -6
  251. package/src/components/Stores/PaymentOptionStripeDirect/index.js +3 -6
  252. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +3 -6
  253. package/src/components/Stores/PaymethodOptionStripeConnect/index.js +3 -6
  254. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +3 -6
  255. package/src/components/Stores/ProductDetails/index.js +5 -8
  256. package/src/components/Stores/ProductExtras/index.js +65 -14
  257. package/src/components/Stores/ProductExtras/styles.js +41 -1
  258. package/src/components/Stores/ProductIngredient/index.js +4 -10
  259. package/src/components/Stores/ProductMainDetails/index.js +4 -6
  260. package/src/components/Stores/ProductTagsList/index.js +4 -12
  261. package/src/components/Users/CustomerCashWallet/index.js +3 -6
  262. package/src/components/Users/CustomerDetails/index.js +13 -11
  263. package/src/components/Users/CustomerPointsWallet/index.js +3 -6
  264. package/src/components/Users/CustomersListing/index.js +15 -8
  265. package/src/components/Users/ProfessionalDetail/index.js +3 -10
  266. package/src/components/Users/ProfessionalList/index.js +11 -1
  267. package/src/components/Users/ProfessionalListing/index.js +15 -8
  268. package/src/components/Users/UserActiveStateFilter/index.js +5 -4
  269. package/src/components/Users/UserDetails/index.js +3 -10
  270. package/src/components/Users/UsersList/index.js +11 -1
  271. package/src/components/Users/UsersListing/index.js +15 -8
  272. package/src/index.js +3 -1
  273. package/src/utils/index.js +27 -0
  274. package/template/pages/AllInOne/index.js +4 -4
  275. package/template/pages/BusinessesList/index.js +4 -4
  276. package/template/pages/CampaignListing/index.js +5 -1
  277. package/template/pages/CustomersList/index.js +5 -4
  278. package/template/pages/DeliveriesManager/index.js +5 -4
  279. package/template/pages/DeliveryDriversList/index.js +5 -4
  280. package/template/pages/DriversCompaniesList/index.js +5 -1
  281. package/template/pages/DriversGroupsList/index.js +5 -1
  282. package/template/pages/DriversManagersList/index.js +5 -4
  283. package/template/pages/EnterprisePromotionList/index.js +1 -0
  284. package/template/pages/GiftCardsList/index.js +5 -1
  285. package/template/pages/ManagersList/index.js +5 -4
  286. package/template/pages/MessagesList/index.js +5 -1
  287. package/template/pages/OpenCarts/index.js +4 -5
  288. package/template/pages/OrderingProducts/index.js +2 -1
  289. package/template/pages/OrdersList/index.js +4 -4
  290. package/template/pages/Professionals/index.js +5 -4
  291. package/template/pages/RecoveryActionListing/index.js +5 -1
  292. package/template/pages/ReviewsList/index.js +5 -1
  293. /package/_bundles/{ordering-ui-admin.462f5c3aad7a320965e9.js.LICENSE.txt → ordering-ui-admin.78f6259366a43cc634db.js.LICENSE.txt} +0 -0
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage } from 'ordering-components-admin-external'
4
4
  import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
5
5
  import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
@@ -9,6 +9,7 @@ import { useTheme } from 'styled-components'
9
9
  import { ThreeDots, XLg } from 'react-bootstrap-icons'
10
10
  import { Dropdown, DropdownButton } from 'react-bootstrap'
11
11
  import { Confirm } from '../../Shared'
12
+ import { addQueryToUrl } from '../../../utils'
12
13
 
13
14
  import {
14
15
  Container,
@@ -39,7 +40,6 @@ export const PaymentOptionStripeDirect = (props) => {
39
40
  handleDeletePaymethod
40
41
  } = props
41
42
 
42
- const history = useHistory()
43
43
  const query = new URLSearchParams(useLocation().search)
44
44
  const theme = useTheme()
45
45
  const [, t] = useLanguage()
@@ -131,10 +131,7 @@ export const PaymentOptionStripeDirect = (props) => {
131
131
  const handleTabClick = (tab, isInitialRender) => {
132
132
  setPaymentTabs(tab)
133
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}`)
134
+ addQueryToUrl({ payemthod_tab: tab })
138
135
  }
139
136
  }
140
137
 
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage } from 'ordering-components-admin-external'
4
4
  import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
5
5
  import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
@@ -9,6 +9,7 @@ import { useTheme } from 'styled-components'
9
9
  import { ThreeDots, XLg } from 'react-bootstrap-icons'
10
10
  import { Dropdown, DropdownButton } from 'react-bootstrap'
11
11
  import { Confirm } from '../../Shared'
12
+ import { addQueryToUrl } from '../../../utils'
12
13
 
13
14
  import {
14
15
  Container,
@@ -39,7 +40,6 @@ export const PaymethodOptionPaypalExpress = (props) => {
39
40
  handleDeletePaymethod
40
41
  } = props
41
42
 
42
- const history = useHistory()
43
43
  const query = new URLSearchParams(useLocation().search)
44
44
  const theme = useTheme()
45
45
  const [, t] = useLanguage()
@@ -127,10 +127,7 @@ export const PaymethodOptionPaypalExpress = (props) => {
127
127
  const handleTabClick = (tab, isInitialRender) => {
128
128
  setPaymentTabs(tab)
129
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}`)
130
+ addQueryToUrl({ payemthod_tab: tab })
134
131
  }
135
132
  }
136
133
 
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage } from 'ordering-components-admin-external'
4
4
  import BilStripe from '@meronex/icons/bi/BilStripe'
5
5
  import { Button, Input, IconButton } from '../../../styles'
@@ -10,6 +10,7 @@ import { useTheme } from 'styled-components'
10
10
  import { ThreeDots, XLg } from 'react-bootstrap-icons'
11
11
  import { Dropdown, DropdownButton } from 'react-bootstrap'
12
12
  import { Confirm } from '../../Shared'
13
+ import { addQueryToUrl } from '../../../utils'
13
14
 
14
15
  import {
15
16
  Container,
@@ -42,7 +43,6 @@ export const PaymethodOptionStripeConnect = (props) => {
42
43
  handleDeletePaymethod
43
44
  } = props
44
45
 
45
- const history = useHistory()
46
46
  const query = new URLSearchParams(useLocation().search)
47
47
  const theme = useTheme()
48
48
  const [, t] = useLanguage()
@@ -126,10 +126,7 @@ export const PaymethodOptionStripeConnect = (props) => {
126
126
  const handleTabClick = (tab, isInitialRender) => {
127
127
  setPaymentTabs(tab)
128
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}`)
129
+ addQueryToUrl({ payemthod_tab: tab })
133
130
  }
134
131
  }
135
132
 
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage } from 'ordering-components-admin-external'
4
4
  import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
5
5
  import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
@@ -9,6 +9,7 @@ import { useTheme } from 'styled-components'
9
9
  import { ThreeDots, XLg } from 'react-bootstrap-icons'
10
10
  import { Dropdown, DropdownButton } from 'react-bootstrap'
11
11
  import { Confirm } from '../../Shared'
12
+ import { addQueryToUrl } from '../../../utils'
12
13
 
13
14
  import {
14
15
  Container,
@@ -39,7 +40,6 @@ export const PaymethodOptionStripeRedirect = (props) => {
39
40
  handleDeletePaymethod
40
41
  } = props
41
42
 
42
- const history = useHistory()
43
43
  const query = new URLSearchParams(useLocation().search)
44
44
  const theme = useTheme()
45
45
  const [, t] = useLanguage()
@@ -131,10 +131,7 @@ export const PaymethodOptionStripeRedirect = (props) => {
131
131
  const handleTabClick = (tab, isInitialRender) => {
132
132
  setPaymentTabs(tab)
133
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}`)
134
+ addQueryToUrl({ payemthod_tab: tab })
138
135
  }
139
136
  }
140
137
 
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { ProductDetatils as ProductDetatilsController } from 'ordering-components-admin-external'
4
4
  import { useWindowSize } from '../../../hooks/useWindowSize'
5
5
  import { MoreSidebarLayout, Personalization } from '../../Shared'
@@ -12,6 +12,7 @@ import { ProductVideos } from '../ProductVideos'
12
12
  import { ProductMainDetails } from '../ProductMainDetails'
13
13
  import { BusinessServiceProfessionals } from '../BusinessServiceProfessionals'
14
14
  import { ServiceDetail } from '../ServiceDetail'
15
+ import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
15
16
 
16
17
  import {
17
18
  Container
@@ -39,7 +40,7 @@ const ProductDetailsUI = (props) => {
39
40
  handleChangeRibbon,
40
41
  cleanFormState
41
42
  } = props
42
- const history = useHistory()
43
+
43
44
  const query = new URLSearchParams(useLocation().search)
44
45
  const { width } = useWindowSize()
45
46
  const [isMenuOpen, setIsMenuOpen] = useState(false)
@@ -53,9 +54,7 @@ const ProductDetailsUI = (props) => {
53
54
  setShowOption(option)
54
55
  setExtraOpen(true)
55
56
  if (!isInitialRender) {
56
- const category = query.get('category')
57
- const product = query.get('product')
58
- history.replace(`${location.pathname}?category=${category}&product=${product}&section=${option}`)
57
+ addQueryToUrl({ section: option })
59
58
  }
60
59
  }
61
60
 
@@ -63,9 +62,7 @@ const ProductDetailsUI = (props) => {
63
62
  setIsExtendExtraOpen(false)
64
63
  setExtraOpen(false)
65
64
  setShowOption(null)
66
- const category = query.get('category')
67
- const product = query.get('product')
68
- history.replace(`${location.pathname}?category=${category}&product=${product}`)
65
+ removeQueryToUrl(['section', 'tab', 'tag', 'ingredient', 'extra'])
69
66
  }
70
67
 
71
68
  const actionSidebar = (value) => {
@@ -1,12 +1,13 @@
1
1
  import React, { useState, useEffect, useRef } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage, ProductExtras as ProductExtrasController } from 'ordering-components-admin-external'
4
4
  import { useWindowSize } from '../../../hooks/useWindowSize'
5
- import { Button, Checkbox, LinkButton } from '../../../styles'
5
+ import { Button, Checkbox, IconButton, Input, LinkButton } from '../../../styles'
6
6
  import { Alert, Confirm, Modal } from '../../Shared'
7
7
  import { ProductExtraOptions } from '../ProductExtraOptions'
8
- import { ChevronRight } from 'react-bootstrap-icons'
8
+ import { ChevronRight, Pencil } from 'react-bootstrap-icons'
9
9
  import { useTheme } from 'styled-components'
10
+ import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
10
11
 
11
12
  import {
12
13
  MainContainer,
@@ -18,7 +19,10 @@ import {
18
19
  Details,
19
20
  ExtraAddForm,
20
21
  AddButtonWrapper,
21
- DragImageWrapper
22
+ DragImageWrapper,
23
+ OptionNameWrapper,
24
+ ExtraOptionEditContainer,
25
+ FormControl
22
26
  } from './styles'
23
27
 
24
28
  const ProductExtrasUI = (props) => {
@@ -42,7 +46,6 @@ const ProductExtrasUI = (props) => {
42
46
  handleUpdateExtraState,
43
47
  setExtrasState
44
48
  } = props
45
- const history = useHistory()
46
49
  const query = new URLSearchParams(useLocation().search)
47
50
  const theme = useTheme()
48
51
  const [, t] = useLanguage()
@@ -52,10 +55,14 @@ const ProductExtrasUI = (props) => {
52
55
  const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
53
56
 
54
57
  const [openExtraDetails, setOpenExtraDetails] = useState(false)
58
+ const [openExtraEdit, setOpenExtraEdit] = useState(false)
55
59
  const [currentExtra, setCurrentExtra] = useState(null)
56
60
  const [extraIds, setExtraIds] = useState([])
57
61
  const [isCheckboxClicked, setIsCheckboxClicked] = useState(false)
58
62
  const [timer, setTimer] = useState(null)
63
+ const [extraSelected, setExtraSelected] = useState(null)
64
+
65
+ const extraInputRef = useRef()
59
66
 
60
67
  const handleOpenExtraDetails = (e, extra, isInitialRender) => {
61
68
  if (e?.target?.closest('.extra-checkbox') || e?.target?.closest('.draggable-dots')) return
@@ -63,10 +70,7 @@ const ProductExtrasUI = (props) => {
63
70
  setCurrentExtra(extra)
64
71
  setOpenExtraDetails(true)
65
72
  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}`)
73
+ addQueryToUrl({ extra: extra.id })
70
74
  }
71
75
  }
72
76
 
@@ -74,10 +78,7 @@ const ProductExtrasUI = (props) => {
74
78
  setOpenExtraDetails(false)
75
79
  setIsExtendExtraOpen(false)
76
80
  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}`)
81
+ removeQueryToUrl(['extra'])
81
82
  }
82
83
 
83
84
  const handleExtraState = (id, checked) => {
@@ -89,6 +90,17 @@ const ProductExtrasUI = (props) => {
89
90
  setIsCheckboxClicked(true)
90
91
  }
91
92
 
93
+ const handleOpenEdit = (event, extra) => {
94
+ event.stopPropagation()
95
+ setExtraSelected(extra)
96
+ setOpenExtraEdit(true)
97
+ }
98
+
99
+ const handleCloseEdit = () => {
100
+ setOpenExtraEdit(false)
101
+ setExtraSelected(null)
102
+ }
103
+
92
104
  const onChangeAddExtraInput = (e) => {
93
105
  e.persist()
94
106
  clearTimeout(timer)
@@ -100,6 +112,21 @@ const ProductExtrasUI = (props) => {
100
112
  setTimer(_timer)
101
113
  }
102
114
 
115
+ const handleChangeExtra = async (id, changes) => {
116
+ if (!extraInputRef?.current?.value) {
117
+ setAlertState({
118
+ open: true,
119
+ content: [t(
120
+ 'VALIDATION_ERROR_REQUIRED',
121
+ 'Name is required'
122
+ ).replace('_attribute_', t('NAME', 'Name'))]
123
+ })
124
+ return
125
+ }
126
+ await handleUpdateExtraState(id, changes)
127
+ handleCloseEdit()
128
+ }
129
+
103
130
  useEffect(() => {
104
131
  let _extraIds = []
105
132
  if (productState.product?.extras) {
@@ -175,7 +202,12 @@ const ProductExtrasUI = (props) => {
175
202
  />
176
203
  </CheckboxContainer>
177
204
  <MoreContainer>
178
- <span>{extra.name}</span>
205
+ <OptionNameWrapper>
206
+ <span className='name'>{extra.name}</span>
207
+ <IconButton onClick={(e) => handleOpenEdit(e, extra)}>
208
+ <Pencil />
209
+ </IconButton>
210
+ </OptionNameWrapper>
179
211
  <Details>
180
212
  <ChevronRight />
181
213
  </Details>
@@ -248,6 +280,25 @@ const ProductExtrasUI = (props) => {
248
280
  )}
249
281
  </>
250
282
  )}
283
+ <Modal
284
+ width='760px'
285
+ open={openExtraEdit}
286
+ onClose={() => handleCloseEdit()}
287
+ padding='20px'
288
+ >
289
+ <ExtraOptionEditContainer>
290
+ <h2>{t('PRODUCT_OPTION', 'Product option')}</h2>
291
+ <FormControl>
292
+ <label>{t('NAME', 'Name')}</label>
293
+ <Input
294
+ placeholder={t('NAME', 'Name')}
295
+ defaultValue={extraSelected?.name}
296
+ ref={extraInputRef}
297
+ />
298
+ </FormControl>
299
+ <Button color='primary' onClick={() => handleChangeExtra(extraSelected?.id, { name: extraInputRef?.current?.value })}>{t('SAVE', 'Save')}</Button>
300
+ </ExtraOptionEditContainer>
301
+ </Modal>
251
302
  <Alert
252
303
  title={t('WEB_APPNAME', 'Ordering')}
253
304
  content={alertState.content}
@@ -81,11 +81,51 @@ export const MoreContainer = styled.div`
81
81
  font-size: 20px;
82
82
  color: ${props => props.theme.colors.headingColor};
83
83
  }
84
+ `
84
85
 
85
- > span {
86
+ export const OptionNameWrapper = styled.div`
87
+ display: flex;
88
+ align-items: center;
89
+ > span.name {
86
90
  font-size: 14px;
87
91
  padding: 0 10px;
88
92
  }
93
+ button {
94
+ width: 24px;
95
+ min-width: 24px;
96
+ height: 24px;
97
+ svg {
98
+ font-size: 14px;
99
+ }
100
+ }
101
+ `
102
+
103
+ export const ExtraOptionEditContainer = styled.div`
104
+ padding: 20px;
105
+
106
+ > h2 {
107
+ font-size: 20px;
108
+ font-weight: 700;
109
+ margin-bottom: 30px;
110
+ }
111
+ button {
112
+ display: block;
113
+ margin-top: 30px;
114
+ height: 44px;
115
+ border-radius: 8px;
116
+ margin-left: auto;
117
+ }
118
+ `
119
+
120
+ export const FormControl = styled.div`
121
+ label {
122
+ font-size: 14px;
123
+ margin-bottom: 10px;
124
+ }
125
+ input {
126
+ width: 100%;
127
+ height: 44px;
128
+ }
89
129
  `
90
130
 
91
131
  export const Details = styled.div`
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage } from 'ordering-components-admin-external'
4
4
  import { useWindowSize } from '../../../hooks/useWindowSize'
5
5
  import { Button, LinkButton } from '../../../styles'
6
6
  import { ProductIngredientDetails } from '../ProductIngredientDetails'
7
7
  import { Modal } from '../../Shared'
8
8
  import { ChevronRight } from 'react-bootstrap-icons'
9
+ import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
9
10
 
10
11
  import {
11
12
  MainContainer,
@@ -21,7 +22,6 @@ export const ProductIngredient = (props) => {
21
22
  setIsExtendExtraOpen
22
23
  } = props
23
24
 
24
- const history = useHistory()
25
25
  const query = new URLSearchParams(useLocation().search)
26
26
  const [, t] = useLanguage()
27
27
  const { width } = useWindowSize()
@@ -33,10 +33,7 @@ export const ProductIngredient = (props) => {
33
33
  setIsExtendExtraOpen(true)
34
34
  setOpenDetails(true)
35
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}`)
36
+ addQueryToUrl({ ingredient: ingredient?.id })
40
37
  }
41
38
  }
42
39
 
@@ -44,10 +41,7 @@ export const ProductIngredient = (props) => {
44
41
  setOpenDetails(false)
45
42
  setIsExtendExtraOpen(false)
46
43
  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}`)
44
+ removeQueryToUrl(['ingredient'])
51
45
  }
52
46
 
53
47
  useEffect(() => {
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage } from 'ordering-components-admin-external'
4
4
  import { DragScroll } from '../../Shared'
5
5
  import { SeoOptions } from '../SeoOptions'
6
6
  import { ProductDetatilsInformation } from '../ProductDetatilsInformation'
7
7
  import { ProductDetailsAdvanced } from '../ProductDetailsAdvanced'
8
8
  import { ProductTagsList } from '../ProductTagsList'
9
+ import { addQueryToUrl } from '../../../utils'
9
10
 
10
11
  import {
11
12
  Container,
@@ -34,7 +35,7 @@ export const ProductMainDetails = (props) => {
34
35
  setFees,
35
36
  cleanFormState
36
37
  } = props
37
- const history = useHistory()
38
+
38
39
  const query = new URLSearchParams(useLocation().search)
39
40
  const [, t] = useLanguage()
40
41
 
@@ -49,10 +50,7 @@ export const ProductMainDetails = (props) => {
49
50
  setSelectedOption(tab)
50
51
  setIsExtendExtraOpen(false)
51
52
  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}`)
53
+ addQueryToUrl({ tab: tab })
56
54
  }
57
55
  }
58
56
 
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage, ProductTagsList as ProductTagsController } from 'ordering-components-admin-external'
4
4
  import Skeleton from 'react-loading-skeleton'
5
5
  import { SearchBar, SideBar } from '../../Shared'
6
6
  import { Button, Checkbox, LinkButton } from '../../../styles'
7
7
  import { ChevronRight, Image as ImageIcon } from 'react-bootstrap-icons'
8
8
  import { ProductTagDetails } from '../ProductTagDetails'
9
+ import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
9
10
 
10
11
  import {
11
12
  TagsListContainer,
@@ -33,7 +34,6 @@ const ProductTagsListUI = (props) => {
33
34
  handleSelectAllTags
34
35
  } = props
35
36
 
36
- const history = useHistory()
37
37
  const query = new URLSearchParams(useLocation().search)
38
38
  const [, t] = useLanguage()
39
39
  const [selectedTag, setSelectedTag] = useState(null)
@@ -48,11 +48,7 @@ const ProductTagsListUI = (props) => {
48
48
  setIsOpenTagDetail(true)
49
49
 
50
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}`)
51
+ addQueryToUrl({ tag: tag?.id })
56
52
  }
57
53
  }
58
54
 
@@ -60,11 +56,7 @@ const ProductTagsListUI = (props) => {
60
56
  setIsOpenTagDetail(false)
61
57
  setIsExtendExtraOpen(false)
62
58
  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}`)
59
+ removeQueryToUrl(['tag'])
68
60
  }
69
61
 
70
62
  useEffect(() => {
@@ -1,8 +1,9 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage, UserWallet as UserWalletController } from 'ordering-components-admin-external'
4
4
  import { CustomerCashWalletDetails } from '../CustomerCashWalletDetails'
5
5
  import { CustomerWalletEvents } from '../CustomerWalletEvents'
6
+ import { addQueryToUrl } from '../../../utils'
6
7
 
7
8
  import {
8
9
  Container,
@@ -11,7 +12,6 @@ import {
11
12
  } from './styles'
12
13
 
13
14
  const CustomerCashWalletUI = (props) => {
14
- const history = useHistory()
15
15
  const query = new URLSearchParams(useLocation().search)
16
16
  const [, t] = useLanguage()
17
17
  const [showOption, setShowOption] = useState('cash_wallet')
@@ -19,10 +19,7 @@ const CustomerCashWalletUI = (props) => {
19
19
  const handleTabClick = (tab, isInitialRender) => {
20
20
  setShowOption(tab)
21
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}`)
22
+ addQueryToUrl({ tab: tab })
26
23
  }
27
24
  }
28
25
 
@@ -1,5 +1,5 @@
1
- import React, { useEffect, useState } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
1
+ import React, { useEffect, useState, useRef } from 'react'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import {
4
4
  UserDetails as UserDetailsController,
5
5
  useLanguage,
@@ -13,6 +13,7 @@ import { UserDetails } from '../UserDetails'
13
13
  import { CustomerCashWallet } from '../CustomerCashWallet'
14
14
  import { Confirm, SideBar } from '../../Shared'
15
15
  import { IconButton, Switch } from '../../../styles'
16
+ import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
16
17
 
17
18
  import {
18
19
  DetailsContainer,
@@ -36,16 +37,17 @@ const CustomerDetailsUI = (props) => {
36
37
  handleDeleteUser,
37
38
  handleParentSidebarMove,
38
39
  handleChangeActiveUser,
39
- setSideBarWidth
40
+ setSideBarWidth,
41
+ userId
40
42
  } = props
41
43
 
42
- const history = useHistory()
43
44
  const query = new URLSearchParams(useLocation().search)
44
45
  const theme = useTheme()
45
46
  const [, t] = useLanguage()
46
47
  const [{ optimizeImage }] = useUtils()
47
48
  const { width } = useWindowSize()
48
49
 
50
+ const firstRender = useRef(true)
49
51
  const [showOption, setShowOption] = useState(null)
50
52
  const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
51
53
  const [isOpenMenu, setIsOpenMenu] = useState(false)
@@ -77,10 +79,9 @@ const CustomerDetailsUI = (props) => {
77
79
  handleParentSidebarMove(isExpand ? width / 2 : 500)
78
80
  setIsOpenMenu(true)
79
81
  if (!isInitialRender) {
80
- const enabled = query.get('enabled')
81
- const id = query.get('id')
82
- history.replace(`${location.pathname}?enabled=${enabled}&id=${id}&section=${key}`)
82
+ addQueryToUrl({ section: key })
83
83
  }
84
+ firstRender.current = false
84
85
  }
85
86
 
86
87
  const handleCloseMenu = () => {
@@ -89,9 +90,7 @@ const CustomerDetailsUI = (props) => {
89
90
  setShowOption(null)
90
91
  setIsOpenMenu(false)
91
92
  setMenuMoveDistance(0)
92
- const enabled = query.get('enabled')
93
- const id = query.get('id')
94
- history.replace(`${location.pathname}?eanbled=${enabled}&id=${id}`)
93
+ removeQueryToUrl(['section', 'tab'])
95
94
  }
96
95
 
97
96
  const expandSidebar = () => {
@@ -102,10 +101,13 @@ const CustomerDetailsUI = (props) => {
102
101
  }
103
102
 
104
103
  useEffect(() => {
104
+ if (firstRender.current) return
105
105
  handleParentSidebarMove(0)
106
106
  setIsOpenMenu(false)
107
107
  setShowOption(null)
108
- }, [userState?.user?.id])
108
+ setSideBarWidth(500)
109
+ removeQueryToUrl(['section', 'tab'])
110
+ }, [userId])
109
111
 
110
112
  useEffect(() => {
111
113
  if (userState.loading) return
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useHistory, useLocation } from 'react-router-dom'
2
+ import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage, UserWallet as UserWalletController } from 'ordering-components-admin-external'
4
4
  import { useTheme } from 'styled-components'
5
5
  import Skeleton from 'react-loading-skeleton'
6
6
  import { CustomerWalletEvents } from '../CustomerWalletEvents'
7
7
  import { Button, Input, TextArea } from '../../../styles'
8
8
  import { Alert } from '../../Shared'
9
+ import { addQueryToUrl } from '../../../utils'
9
10
 
10
11
  import {
11
12
  Container,
@@ -33,7 +34,6 @@ const CustomerPointsWalletUI = (props) => {
33
34
  handleReduceWalletMoney
34
35
  } = props
35
36
 
36
- const history = useHistory()
37
37
  const query = new URLSearchParams(useLocation().search)
38
38
  const [, t] = useLanguage()
39
39
  const theme = useTheme()
@@ -44,10 +44,7 @@ const CustomerPointsWalletUI = (props) => {
44
44
  const handleTabClick = (tab, isInitialRender) => {
45
45
  setShowOption(tab)
46
46
  if (!isInitialRender) {
47
- const enabled = query.get('enabled')
48
- const id = query.get('id')
49
- const section = query.get('section')
50
- history.replace(`${location.pathname}?enabled=${enabled}&id=${id}&section=${section}&tab=${tab}`)
47
+ addQueryToUrl({ tab: tab })
51
48
  }
52
49
  }
53
50