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,10 +1,12 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import Skeleton from 'react-loading-skeleton'
4
5
  import { Pagination } from '../../Shared'
5
6
  import MdCheckBoxOutlineBlank from '@meronex/icons/md/MdCheckBoxOutlineBlank'
6
7
  import MdCheckBox from '@meronex/icons/md/MdCheckBox'
7
8
  import { Switch, LinkButton } from '../../../styles'
9
+ import { addQueryToUrl } from '../../../utils'
8
10
 
9
11
  import {
10
12
  DriversCompaniesContainer,
@@ -28,14 +30,18 @@ export const DriversCompaniesList = (props) => {
28
30
  handleUpdateDriversCompany,
29
31
  handleSelectCompany,
30
32
  selectedCompanyList,
31
- handleAllSelectCompany
33
+ handleAllSelectCompany,
34
+ isUseQuery
32
35
  } = props
33
36
 
34
37
  const [, t] = useLanguage()
38
+ const query = new URLSearchParams(useLocation().search)
39
+ const defaultPage = query.get('page') || 1
40
+ const defaultPageSize = query.get('pageSize') || 10
35
41
 
36
42
  // Change page
37
- const [currentPage, setCurrentPage] = useState(1)
38
- const [companiesPerPage, setCompaniesPerPage] = useState(10)
43
+ const [currentPage, setCurrentPage] = useState(Number(defaultPage) || 1)
44
+ const [companiesPerPage, setCompaniesPerPage] = useState(Number(defaultPageSize) || 10)
39
45
 
40
46
  // Get current companies
41
47
  const [currentCompanies, setCurrentCompanies] = useState([])
@@ -91,6 +97,14 @@ export const DriversCompaniesList = (props) => {
91
97
  handleOpenDetails(company)
92
98
  }
93
99
 
100
+ useEffect(() => {
101
+ if (!isUseQuery || !currentPage || !companiesPerPage || !totalPages) return
102
+ addQueryToUrl({
103
+ page: currentPage,
104
+ pageSize: companiesPerPage
105
+ })
106
+ }, [currentPage, companiesPerPage, totalPages])
107
+
94
108
  return (
95
109
  <>
96
110
  <DriversCompaniesContainer>
@@ -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 {
4
4
  useLanguage,
5
5
  DriversCompaniesList as DriversCompaniesListController
@@ -11,6 +11,7 @@ import { Alert, Confirm, SearchBar, SideBar } from '../../Shared'
11
11
  import { DriversCompaniesList } from '../DriversCompaniesList'
12
12
  import { DriversCompanyDetailsForm } from '../DriversCompanyDetailsForm'
13
13
  import { DriversCompanyAddForm } from '../DriversCompanyAddForm'
14
+ import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
14
15
 
15
16
  import {
16
17
  DriversCompaniesListContainer,
@@ -31,10 +32,10 @@ const DriversCompaniesListingUI = (props) => {
31
32
  handleSelectCompany,
32
33
  selectedCompanyList,
33
34
  handleAllSelectCompany,
34
- handleDeleteSelectedCompanies
35
+ handleDeleteSelectedCompanies,
36
+ isUseQuery
35
37
  } = props
36
38
 
37
- const history = useHistory()
38
39
  const query = new URLSearchParams(useLocation().search)
39
40
  const [, t] = useLanguage()
40
41
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
@@ -54,7 +55,7 @@ const DriversCompaniesListingUI = (props) => {
54
55
  }
55
56
  setOpenDetails(true)
56
57
  if (!isInitialRender) {
57
- history.replace(`${location.pathname}?id=${driverCompany?.id}`)
58
+ addQueryToUrl({ id: driverCompany?.id })
58
59
  }
59
60
  }
60
61
 
@@ -82,7 +83,7 @@ const DriversCompaniesListingUI = (props) => {
82
83
  setCurDriversCompanyId(null)
83
84
  setOpenDetails(false)
84
85
  setIsAddMode(false)
85
- history.replace(`${location.pathname}`)
86
+ removeQueryToUrl(['id', 'tab'])
86
87
  }
87
88
 
88
89
  useEffect(() => {
@@ -142,6 +143,7 @@ const DriversCompaniesListingUI = (props) => {
142
143
  handleSelectCompany={handleSelectCompany}
143
144
  selectedCompanyList={selectedCompanyList}
144
145
  handleAllSelectCompany={handleAllSelectCompany}
146
+ isUseQuery={isUseQuery}
145
147
  />
146
148
  ) : (
147
149
  <DriversCompanyAddForm
@@ -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 {
4
4
  useLanguage,
5
5
  DriversCompanyDetails as DriversCompanyDetailsController
@@ -12,6 +12,7 @@ import { Alert, Confirm, DragScroll } from '../../Shared'
12
12
  import { DriversCompanyGeneralDetails } from '../DriversCompanyGeneralDetails'
13
13
  import { DriversCompanyScheduleDetails } from '../DriversCompanyScheduleDetails'
14
14
  import { DriversCompanyWebhooksDetails } from '../DriversCompanyWebhooksDetails'
15
+ import { addQueryToUrl } from '../../../utils'
15
16
 
16
17
  import {
17
18
  DetailsContainer,
@@ -33,7 +34,6 @@ const DriversCompanyDetailsFormUI = (props) => {
33
34
  handleDeleteDriversCompany
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()
@@ -88,8 +88,7 @@ const DriversCompanyDetailsFormUI = (props) => {
88
88
  const handleTabClick = (tab, isInitialRender) => {
89
89
  setCurrentTabItem(tab)
90
90
  if (!isInitialRender) {
91
- const id = query.get('id')
92
- history.replace(`${location.pathname}?id=${id}&tab=${tab}`)
91
+ addQueryToUrl({ tab: tab })
93
92
  }
94
93
  }
95
94
 
@@ -1,5 +1,5 @@
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 {
4
4
  useLanguage,
5
5
  useConfig,
@@ -17,6 +17,7 @@ import { DriversGroupLogistics } from '../DriversGroupLogistics'
17
17
  import { DriversGroupLogs } from '../DriversGroupLogs'
18
18
  import { DriverGroupDeliveryDetails } from '../DriversGroupDeliveryDetails'
19
19
  import { useWindowSize } from '../../../hooks/useWindowSize'
20
+ import { addQueryToUrl } from '../../../utils'
20
21
 
21
22
  import {
22
23
  DetailsContainer,
@@ -40,7 +41,6 @@ const DriversGroupDetailsUI = (props) => {
40
41
  driversGroupId
41
42
  } = props
42
43
 
43
- const history = useHistory()
44
44
  const query = new URLSearchParams(useLocation().search)
45
45
  const theme = useTheme()
46
46
  const [, t] = useLanguage()
@@ -126,8 +126,7 @@ const DriversGroupDetailsUI = (props) => {
126
126
  const handleTabClick = (tab, isInitialRender) => {
127
127
  setShowMenu(tab)
128
128
  if (!isInitialRender) {
129
- const id = query.get('id')
130
- history.replace(`${location.pathname}?id=${id}&tab=${tab}`)
129
+ addQueryToUrl({ tab: tab })
131
130
  }
132
131
  }
133
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 { Circle, RecordCircleFill, ChevronRight } from 'react-bootstrap-icons'
5
5
  import { useWindowSize } from '../../../hooks/useWindowSize'
@@ -8,6 +8,7 @@ import { SideBar, Modal } from '../../Shared'
8
8
  import { DriversGroupOrders } from '../DriversGroupOrders'
9
9
  import { DriversGroupAutoassign } from '../DriversGroupAutoassign'
10
10
  import { DriversMarkAsBusy } from '../DriversMarkAsBusy'
11
+ import { addQueryToUrl } from '../../../utils'
11
12
 
12
13
  import {
13
14
  LogisticsContainer,
@@ -27,7 +28,6 @@ export const DriversGroupLogistics = (props) => {
27
28
  actionDisabled
28
29
  } = props
29
30
 
30
- const history = useHistory()
31
31
  const query = new URLSearchParams(useLocation().search)
32
32
  const [, t] = useLanguage()
33
33
  const { width } = useWindowSize()
@@ -43,9 +43,7 @@ export const DriversGroupLogistics = (props) => {
43
43
  }
44
44
 
45
45
  if (!isInitialRender) {
46
- const id = query.get('id')
47
- const tab = query.get('tab')
48
- history.replace(`${location.pathname}?id=${id}&tab=${tab}&config=${option}`)
46
+ addQueryToUrl({ config: option })
49
47
  }
50
48
  }
51
49
 
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import Skeleton from 'react-loading-skeleton'
4
5
  import MdCheckBoxOutlineBlank from '@meronex/icons/md/MdCheckBoxOutlineBlank'
@@ -6,6 +7,7 @@ import MdCheckBox from '@meronex/icons/md/MdCheckBox'
6
7
  import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
7
8
  import { Switch, LinkButton } from '../../../styles'
8
9
  import { Pagination } from '../../Shared'
10
+ import { addQueryToUrl } from '../../../utils'
9
11
 
10
12
  import {
11
13
  DriversGroupsContainer,
@@ -35,14 +37,18 @@ export const DriversGroupsList = (props) => {
35
37
  isFromStore,
36
38
  handleSelectGroup,
37
39
  handleAllSelectGroup,
38
- actionDisabled
40
+ actionDisabled,
41
+ isUseQuery
39
42
  } = props
40
43
 
41
44
  const [, t] = useLanguage()
45
+ const query = new URLSearchParams(useLocation().search)
46
+ const defaultPage = query.get('page') || 1
47
+ const defaultPageSize = query.get('pageSize') || 10
42
48
 
43
49
  // Change page
44
- const [currentPage, setCurrentPage] = useState(1)
45
- const [groupsPerPage, setGroupsPerPage] = useState(10)
50
+ const [currentPage, setCurrentPage] = useState(Number(defaultPage) || 1)
51
+ const [groupsPerPage, setGroupsPerPage] = useState(Number(defaultPageSize) || 10)
46
52
 
47
53
  // Get current groups
48
54
  const [currentGroups, setCurrentGroups] = useState([])
@@ -92,6 +98,14 @@ export const DriversGroupsList = (props) => {
92
98
  }
93
99
  }
94
100
 
101
+ useEffect(() => {
102
+ if (!isUseQuery || !currentPage || !groupsPerPage || !totalPages) return
103
+ addQueryToUrl({
104
+ page: currentPage,
105
+ pageSize: groupsPerPage
106
+ })
107
+ }, [currentPage, groupsPerPage, totalPages])
108
+
95
109
  return (
96
110
  <>
97
111
  <DriversGroupsContainer>
@@ -3,7 +3,7 @@ import { useHistory, useLocation } from 'react-router-dom'
3
3
  import { useLanguage, DriversGroupsList as DriversGroupsListController } from 'ordering-components-admin-external'
4
4
  import { List as MenuIcon, LifePreserver } from 'react-bootstrap-icons'
5
5
  import { OverlayTrigger, Tooltip } from 'react-bootstrap'
6
- import { getStorageItem, removeStorageItem } from '../../../utils'
6
+ import { getStorageItem, removeStorageItem, addQueryToUrl, removeQueryToUrl } from '../../../utils'
7
7
  import { useInfoShare } from '../../../contexts/InfoShareContext'
8
8
  import { Button, IconButton } from '../../../styles'
9
9
  import { Alert, Confirm, SearchBar, SideBar } from '../../Shared'
@@ -35,7 +35,8 @@ const DriversGroupsListingUI = (props) => {
35
35
  handleUpdateDriversGroup,
36
36
  handleDeleteDriversGroup,
37
37
  driversCompanyList,
38
- actionDisabled
38
+ actionDisabled,
39
+ isUseQuery
39
40
  } = props
40
41
 
41
42
  const history = useHistory()
@@ -66,9 +67,9 @@ const DriversGroupsListingUI = (props) => {
66
67
  setTimeout(() => {
67
68
  setCurrentTourStep(5)
68
69
  }, 50)
69
- history.replace(`${location.pathname}`)
70
+ removeQueryToUrl(['id'])
70
71
  } else {
71
- history.replace(`${location.pathname}?id=${driverGroup.id}`)
72
+ addQueryToUrl({ id: driverGroup.id })
72
73
  }
73
74
  }
74
75
 
@@ -127,7 +128,7 @@ const DriversGroupsListingUI = (props) => {
127
128
  setCurDriversGroup(null)
128
129
  setOpenDetails(false)
129
130
  setIsTourOpen(false)
130
- history.replace(`${location.pathname}`)
131
+ removeQueryToUrl(['id'])
131
132
  }
132
133
 
133
134
  useEffect(() => {
@@ -208,6 +209,7 @@ const DriversGroupsListingUI = (props) => {
208
209
  handleSelectGroup={handleSelectGroup}
209
210
  handleAllSelectGroup={handleAllSelectGroup}
210
211
  actionDisabled={actionDisabled}
212
+ isUseQuery={isUseQuery}
211
213
  />
212
214
  ) : (
213
215
  <DriversGroupAddForm
@@ -1,5 +1,5 @@
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 Skeleton from 'react-loading-skeleton'
4
4
  import { useTheme } from 'styled-components'
5
5
  import { Dropdown, DropdownButton } from 'react-bootstrap'
@@ -16,6 +16,8 @@ import { DriverGroupSetting } from '../DriverGroupSetting'
16
16
  import { ArrowsAngleContract, ArrowsAngleExpand, ThreeDots } from 'react-bootstrap-icons'
17
17
  import { Switch, Button, IconButton } from '../../../styles'
18
18
  import { ActionsForm } from '../UserFormDetails/styles'
19
+ import { addQueryToUrl } from '../../../utils'
20
+
19
21
  import {
20
22
  UserName,
21
23
  SavedPlaces,
@@ -42,7 +44,6 @@ export const UserDetailsUI = (props) => {
42
44
  actionDisabled
43
45
  } = props
44
46
 
45
- const history = useHistory()
46
47
  const query = new URLSearchParams(useLocation().search)
47
48
  const theme = useTheme()
48
49
  const [, t] = useLanguage()
@@ -67,13 +68,7 @@ export const UserDetailsUI = (props) => {
67
68
  const handleTabClick = (tab, isInitialRender) => {
68
69
  setCurrentMenuSelected(tab)
69
70
  if (!isInitialRender) {
70
- const id = query.get('id')
71
- const section = query.get('section')
72
- if (section) {
73
- history.replace(`${location.pathname}?id=${id}&section=${section}&tab=${tab}`)
74
- } else {
75
- history.replace(`${location.pathname}?id=${id}&tab=${tab}`)
76
- }
71
+ addQueryToUrl({ tab: tab })
77
72
  }
78
73
  }
79
74
 
@@ -164,6 +164,14 @@ export const UserFormDetailsUI = (props) => {
164
164
  emailInput.current.value = e.target.value?.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, '')
165
165
  }
166
166
 
167
+ const handleExternalIdPaste = (event) => {
168
+ event.preventDefault()
169
+ const pastedData = event.clipboardData.getData('text/plain')
170
+ const sanitizedData = pastedData.replace(/\s/g, '').replace(/[^\d]/g, '')
171
+ document.execCommand('insertText', false, sanitizedData)
172
+ handleChangeSwtich('external_id', sanitizedData)
173
+ }
174
+
167
175
  useEffect(() => {
168
176
  if (Object.keys(formMethods.errors).length > 0) {
169
177
  const content = Object.values(formMethods.errors).map(error => error.message)
@@ -289,6 +297,7 @@ export const UserFormDetailsUI = (props) => {
289
297
  e.preventDefault()
290
298
  }
291
299
  }}
300
+ onPaste={handleExternalIdPaste}
292
301
  />
293
302
  <InputWrapper isTimezone>
294
303
  <DefaultSelect
@@ -8,6 +8,7 @@ import { Envelope, Phone } from 'react-bootstrap-icons'
8
8
 
9
9
  import { Switch, LinkButton } from '../../../styles'
10
10
  import { Pagination, ConfirmAdmin } from '../../Shared'
11
+ import { addQueryToUrl } from '../../../utils'
11
12
 
12
13
  import {
13
14
  UsersConatiner,
@@ -42,7 +43,8 @@ export const UsersList = (props) => {
42
43
  isDriversManagersPage,
43
44
  actionDisabled,
44
45
  setSelectedUsers,
45
- handleChangeAvailable
46
+ handleChangeAvailable,
47
+ isUseQuery
46
48
  } = props
47
49
 
48
50
  const [, t] = useLanguage()
@@ -109,6 +111,14 @@ export const UsersList = (props) => {
109
111
  }
110
112
  }, [usersList.users, paginationProps])
111
113
 
114
+ useEffect(() => {
115
+ if (!isUseQuery || !paginationProps?.currentPage || !paginationProps?.pageSize || !paginationProps?.totalPages) return
116
+ addQueryToUrl({
117
+ page: paginationProps.currentPage,
118
+ pageSize: paginationProps.pageSize
119
+ })
120
+ }, [paginationProps?.currentPage, paginationProps?.pageSize, paginationProps?.totalPages])
121
+
112
122
  return (
113
123
  <>
114
124
  <UsersConatiner>
@@ -1,5 +1,5 @@
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 { useInfoShare } from '../../../contexts/InfoShareContext'
5
5
  import { IconButton } from '../../../styles'
@@ -7,6 +7,7 @@ import { List as MenuIcon, HouseDoor, ViewStacked, Shop, InfoCircle } from 'reac
7
7
  import { PostionItemUI } from './PostionItemUI'
8
8
  import { SideBar } from '../../Shared'
9
9
  import { PageBanners } from '../PageBanner'
10
+ import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
10
11
 
11
12
  import {
12
13
  AdBannersListingContainer,
@@ -17,7 +18,6 @@ import {
17
18
  } from './styles'
18
19
 
19
20
  export const AdBannersListing = (props) => {
20
- const history = useHistory()
21
21
  const query = new URLSearchParams(useLocation().search)
22
22
  const [, t] = useLanguage()
23
23
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
@@ -76,14 +76,15 @@ export const AdBannersListing = (props) => {
76
76
  const selectedItem = bannerPositions.find(item => item.key === key)
77
77
  setOpenPositionDetail(selectedItem)
78
78
  if (!isInitialRender) {
79
- history.replace(`${location.pathname}?position=${key}`)
79
+ removeQueryToUrl(['banner'])
80
+ addQueryToUrl({ position: key })
80
81
  }
81
82
  }
82
83
 
83
84
  const handleCloseDetails = () => {
84
85
  setOpenPositionDetail(null)
85
86
  setMoveDistance(0)
86
- history.replace(`${location.pathname}`)
87
+ removeQueryToUrl(['position', 'banner'])
87
88
  }
88
89
 
89
90
  useEffect(() => {
@@ -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 { useTheme } from 'styled-components'
4
4
  import { Dropdown, DropdownButton } from 'react-bootstrap'
5
5
  import { useLanguage, CampaignDetail as CampaignDetailController } from 'ordering-components-admin-external'
@@ -7,6 +7,7 @@ import { ArrowsAngleContract, ArrowsAngleExpand, ThreeDots } from 'react-bootstr
7
7
  import { Confirm, Alert } from '../../Shared'
8
8
  import { CampaignDetailGeneral } from '../CampaignDetailGeneral'
9
9
  import { CampaignDetailContent } from '../CampaignDetailContent'
10
+ import { addQueryToUrl } from '../../../utils'
10
11
 
11
12
  import {
12
13
  CampaignDetailContainer,
@@ -29,7 +30,6 @@ const CampaignDetailUI = (props) => {
29
30
  handleDeleteCampaign
30
31
  } = props
31
32
 
32
- const history = useHistory()
33
33
  const query = new URLSearchParams(useLocation().search)
34
34
  const theme = useTheme()
35
35
  const [, t] = useLanguage()
@@ -83,8 +83,7 @@ const CampaignDetailUI = (props) => {
83
83
  setSelectedOption(tab)
84
84
 
85
85
  if (!isInitialRender) {
86
- const id = query.get('id')
87
- history.replace(`${location.pathname}?id=${id}&tab=${tab}`)
86
+ addQueryToUrl({ tab: tab })
88
87
  }
89
88
  }
90
89
 
@@ -1,8 +1,9 @@
1
- import React, { useState } from 'react'
1
+ import React, { useState, useEffect } from 'react'
2
2
  import Skeleton from 'react-loading-skeleton'
3
3
  import { useLanguage } from 'ordering-components-admin-external'
4
4
  import { Switch, LinkButton } from '../../../styles'
5
5
  import { ColumnAllowSettingPopover, Pagination, Modal } from '../../Shared'
6
+ import { addQueryToUrl } from '../../../utils'
6
7
 
7
8
  import {
8
9
  Container,
@@ -25,7 +26,8 @@ export const CampaignList = (props) => {
25
26
  handleOpenDetail,
26
27
  selectedCampaign,
27
28
  handleUpdateCampaign,
28
- setSelectedCampaign
29
+ setSelectedCampaign,
30
+ isUseQuery
29
31
  } = props
30
32
 
31
33
  const [, t] = useLanguage()
@@ -123,6 +125,14 @@ export const CampaignList = (props) => {
123
125
  setOpenModal(true)
124
126
  }
125
127
 
128
+ useEffect(() => {
129
+ if (!isUseQuery || !paginationProps?.currentPage || !paginationProps?.pageSize || !paginationProps?.totalPages) return
130
+ addQueryToUrl({
131
+ page: paginationProps.currentPage,
132
+ pageSize: paginationProps.pageSize
133
+ })
134
+ }, [paginationProps?.currentPage, paginationProps?.pageSize, paginationProps?.totalPages])
135
+
126
136
  return (
127
137
  <>
128
138
  <Container>
@@ -1,16 +1,17 @@
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 { SideBar } from '../../Shared'
4
4
  import { CampaignDetail } from '../CampaignDetail'
5
5
  import { CampaignHeader } from '../CampaignHeader'
6
6
  import { CampaignList } from '../CampaignList'
7
7
  import { CampaignListing as CampaignListingController } from 'ordering-components-admin-external'
8
+ import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
9
+
8
10
  import {
9
11
  CampaignListingContainer
10
12
  } from './styles'
11
13
 
12
14
  export const CampaignListingUI = (props) => {
13
- const history = useHistory()
14
15
  const query = new URLSearchParams(useLocation().search)
15
16
  const [isOpenDetail, setIsOpenDetail] = useState(false)
16
17
  const [selectedCampaign, setSelectedCampaign] = useState(null)
@@ -20,13 +21,13 @@ export const CampaignListingUI = (props) => {
20
21
  setSelectedCampaign(action)
21
22
  setSelectedCampaignId(action?.id)
22
23
  setIsOpenDetail(true)
23
- action && history.replace(`${location.pathname}?id=${action?.id}`)
24
+ addQueryToUrl({ id: action?.id })
24
25
  }
25
26
 
26
27
  const handleCloseDetail = () => {
27
28
  setIsOpenDetail(false)
28
29
  setSelectedCampaign(null)
29
- history.replace(`${location.pathname}`)
30
+ removeQueryToUrl(['id'])
30
31
  }
31
32
 
32
33
  useEffect(() => {
@@ -72,11 +73,19 @@ export const CampaignListingUI = (props) => {
72
73
  }
73
74
 
74
75
  export const CampaignListing = (props) => {
76
+ const query = new URLSearchParams(useLocation().search)
77
+ const defaultPage = query.get('page') || 1
78
+ const defaultPageSize = query.get('pageSize') || 10
75
79
  const campaignListingProps = {
76
80
  ...props,
77
81
  UIComponent: CampaignListingUI,
78
82
  isSearchByContactType: true,
79
- isSearchByName: true
83
+ isSearchByName: true,
84
+ paginationSettings: {
85
+ initialPage: props.isUseQuery && !isNaN(defaultPage) ? Number(defaultPage) : 1,
86
+ pageSize: props.isUseQuery && !isNaN(defaultPage) ? Number(defaultPageSize) : 10,
87
+ controlType: 'pages'
88
+ }
80
89
  }
81
90
  return <CampaignListingController {...campaignListingProps} />
82
91
  }
@@ -5,6 +5,7 @@ import { useTheme } from 'styled-components'
5
5
  import { Image as ImageIcon } from 'react-bootstrap-icons'
6
6
  import { ColumnAllowSettingPopover, Pagination } from '../../Shared'
7
7
  import { Switch, LinkButton } from '../../../styles'
8
+ import { addQueryToUrl } from '../../../utils'
8
9
 
9
10
  import {
10
11
  PromotionListContainer,
@@ -39,7 +40,8 @@ export const EnterprisePromotionList = (props) => {
39
40
  handleDrop,
40
41
  handleDragEnd,
41
42
  handleEnablePromotion,
42
- isPromotionBottom
43
+ isPromotionBottom,
44
+ isUseQuery
43
45
  } = props
44
46
 
45
47
  const [, t] = useLanguage()
@@ -107,6 +109,14 @@ export const EnterprisePromotionList = (props) => {
107
109
  }
108
110
  }, [promotionListState.promotions, paginationProps])
109
111
 
112
+ useEffect(() => {
113
+ if (!isUseQuery || !paginationProps?.currentPage || !paginationProps?.pageSize || !paginationProps?.totalPages) return
114
+ addQueryToUrl({
115
+ page: paginationProps.currentPage,
116
+ pageSize: paginationProps.pageSize
117
+ })
118
+ }, [paginationProps?.currentPage, paginationProps?.pageSize, paginationProps?.totalPages])
119
+
110
120
  return (
111
121
  <>
112
122
  <PromotionListContainer eventDisabled={eventDisabled}>
@@ -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 { useConfig, useSession, useLanguage, EnterprisePromotionList as EnterprisePromontioListController } from 'ordering-components-admin-external'
4
4
  import { List as MenuIcon } from 'react-bootstrap-icons'
5
5
  import { useInfoShare } from '../../../contexts/InfoShareContext'
@@ -8,6 +8,7 @@ import { Alert, SearchBar, SideBar } from '../../Shared'
8
8
  import { EnterprisePromotionList } from '../EnterprisePromotionList'
9
9
  import { EnterprisePromotionDetails } from '../EnterprisePromotionDetails'
10
10
  import { DisabledFeatureAlert } from '../../DisabledFeatureAlert'
11
+ import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
11
12
 
12
13
  import {
13
14
  PromotionsListingContainer,
@@ -29,7 +30,6 @@ const EnterprisePromotionListingUI = (props) => {
29
30
  handleSuccessDeletePromotion
30
31
  } = props
31
32
 
32
- const history = useHistory()
33
33
  const query = new URLSearchParams(useLocation().search)
34
34
  const [, t] = useLanguage()
35
35
  const [{ configs }] = useConfig()
@@ -53,7 +53,7 @@ const EnterprisePromotionListingUI = (props) => {
53
53
  setCurPromotionId(promotion?.id)
54
54
  setOpenDetails(true)
55
55
  if (promotion) {
56
- history.replace(`${location.pathname}?id=${promotion?.id}`)
56
+ addQueryToUrl({ id: promotion?.id })
57
57
  }
58
58
  }
59
59
 
@@ -62,7 +62,7 @@ const EnterprisePromotionListingUI = (props) => {
62
62
  setSideBarWidth(600)
63
63
  setOpenDetails(false)
64
64
  setSelectedPromotion(null)
65
- history.replace(`${location.pathname}`)
65
+ removeQueryToUrl(['id'])
66
66
  }
67
67
 
68
68
  useEffect(() => {
@@ -167,9 +167,17 @@ const EnterprisePromotionListingUI = (props) => {
167
167
  }
168
168
 
169
169
  export const EnterprisePromotionListing = (props) => {
170
+ const query = new URLSearchParams(useLocation().search)
171
+ const defaultPage = query.get('page') || 1
172
+ const defaultPageSize = query.get('pageSize') || 10
170
173
  const enterpisePromotionsProps = {
171
174
  ...props,
172
- UIComponent: EnterprisePromotionListingUI
175
+ UIComponent: EnterprisePromotionListingUI,
176
+ paginationSettings: {
177
+ initialPage: props.isUseQuery && !isNaN(defaultPage) ? Number(defaultPage) : 1,
178
+ pageSize: props.isUseQuery && !isNaN(defaultPage) ? Number(defaultPageSize) : 10,
179
+ controlType: 'pages'
180
+ }
173
181
  }
174
182
  return <EnterprisePromontioListController {...enterpisePromotionsProps} />
175
183
  }