ordering-ui-admin-external 1.14.3 → 1.15.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 (134) hide show
  1. package/package.json +2 -2
  2. package/src/components/BusinessIntelligence/BusinessReviewDetails/index.js +4 -4
  3. package/src/components/BusinessIntelligence/BusinessReviewList/index.js +29 -6
  4. package/src/components/BusinessIntelligence/InvoiceBusinessManager/index.js +17 -1
  5. package/src/components/BusinessIntelligence/InvoiceDriverManager/index.js +17 -1
  6. package/src/components/BusinessIntelligence/InvoiceManager/index.js +16 -2
  7. package/src/components/BusinessIntelligence/InvoiceOrdertype/styles.js +1 -0
  8. package/src/components/BusinessIntelligence/ProductReviewDetails/index.js +4 -4
  9. package/src/components/BusinessIntelligence/Reports/index.js +16 -2
  10. package/src/components/BusinessIntelligence/ReviewProductsListing/index.js +34 -6
  11. package/src/components/BusinessIntelligence/ReviewsListing/index.js +31 -5
  12. package/src/components/BusinessIntelligence/UserReviewDetails/index.js +4 -4
  13. package/src/components/BusinessIntelligence/UsersReviewList/index.js +32 -11
  14. package/src/components/CartRecovery/RecoveryActionDetail/index.js +19 -1
  15. package/src/components/CartRecovery/RecoveryActionListing/index.js +21 -3
  16. package/src/components/Delivery/DeliveryUsersListing/index.js +3 -1
  17. package/src/components/Delivery/DriversCompaniesListing/index.js +27 -9
  18. package/src/components/Delivery/DriversCompanyDetailsForm/index.js +37 -8
  19. package/src/components/Delivery/DriversGroupDetails/index.js +36 -4
  20. package/src/components/Delivery/DriversGroupLogistics/index.js +18 -2
  21. package/src/components/Delivery/DriversGroupsListing/index.js +20 -6
  22. package/src/components/Delivery/UserDetails/index.js +26 -1
  23. package/src/components/Loyalty/GiftCardDetail/styles.js +192 -0
  24. package/src/components/Loyalty/GiftCards/index.js +22 -2
  25. package/src/components/Loyalty/PointsWalletBusinessList/index.js +24 -1
  26. package/src/components/Loyalty/PointsWalletLevels/index.js +21 -1
  27. package/src/components/Loyalty/RewardsPrograms/index.js +30 -3
  28. package/src/components/Loyalty/Wallet/index.js +22 -1
  29. package/src/components/Marketing/AdBannersListing/index.js +25 -8
  30. package/src/components/Marketing/BannerImageDetails/index.js +2 -1
  31. package/src/components/Marketing/CampaignDetail/index.js +22 -1
  32. package/src/components/Marketing/CampaignEmail/styles.js +3 -0
  33. package/src/components/Marketing/CampaignListing/index.js +18 -1
  34. package/src/components/Marketing/CampaignNotification/styles.js +3 -0
  35. package/src/components/Marketing/CampaignSMS/styles.js +3 -0
  36. package/src/components/Marketing/EnterprisePromotionGeneralDetails/index.js +2 -1
  37. package/src/components/Marketing/EnterprisePromotionListing/index.js +19 -1
  38. package/src/components/Marketing/PageBanner/index.js +26 -3
  39. package/src/components/Messages/MessagesListing/index.js +17 -0
  40. package/src/components/MyProducts/AdvancedSettings/FontStyleGroup.js +64 -0
  41. package/src/components/MyProducts/AdvancedSettings/OrderType.js +40 -0
  42. package/src/components/MyProducts/AdvancedSettings/SettingComponent.js +104 -0
  43. package/src/components/MyProducts/AdvancedSettings/index.js +541 -0
  44. package/src/components/MyProducts/AdvancedSettings/styles.js +388 -0
  45. package/src/components/MyProducts/AppLayout/index.js +19 -2
  46. package/src/components/MyProducts/AppLayout/styles.js +65 -0
  47. package/src/components/MyProducts/CallCenterApp/index.js +1 -1
  48. package/src/components/MyProducts/CustomerApp/index.js +2 -2
  49. package/src/components/MyProducts/DriverApp/index.js +2 -2
  50. package/src/components/MyProducts/KioskApp/index.js +1 -1
  51. package/src/components/MyProducts/OrderingWebsite/index.js +309 -255
  52. package/src/components/MyProducts/OrderingWebsite/styles.js +99 -2
  53. package/src/components/MyProducts/PosApp/index.js +1 -1
  54. package/src/components/MyProducts/StoreApp/index.js +2 -2
  55. package/src/components/OrderingProducts/OrderingProductDetails/index.js +24 -2
  56. package/src/components/OrderingProducts/OrderingProductsListing/index.js +17 -1
  57. package/src/components/Orders/DeliveriesManager/index.js +0 -1
  58. package/src/components/Orders/Messages/index.js +31 -11
  59. package/src/components/Orders/OrderDetails/index.js +34 -20
  60. package/src/components/Orders/OrderDetailsHeader/index.js +2 -3
  61. package/src/components/Orders/OrdersContentHeader/index.js +1 -1
  62. package/src/components/Orders/OrdersFilterGroup/index.js +111 -13
  63. package/src/components/Orders/OrdersFilterGroup/styles.js +26 -0
  64. package/src/components/Orders/OrdersManager/index.js +0 -1
  65. package/src/components/Settings/CountriesList/index.js +26 -6
  66. package/src/components/Settings/Deliverect/index.js +26 -2
  67. package/src/components/Settings/DoordashConnect/index.js +26 -2
  68. package/src/components/Settings/DropdownOptionList/index.js +27 -6
  69. package/src/components/Settings/IntegrationListing/index.js +3 -3
  70. package/src/components/Settings/ItsaCheckmate/index.js +26 -2
  71. package/src/components/Settings/LalamoveConnect/index.js +26 -2
  72. package/src/components/Settings/PickerExpress/index.js +26 -2
  73. package/src/components/Settings/PlaceListing/index.js +38 -6
  74. package/src/components/Settings/Settings/index.js +79 -37
  75. package/src/components/Settings/SettingsDetail/index.js +15 -1
  76. package/src/components/Settings/SitesAuthSettings/index.js +18 -1
  77. package/src/components/SidebarMenu/index.js +0 -2
  78. package/src/components/Stores/BusinessAdd/BusinessDetails/index.js +1 -10
  79. package/src/components/Stores/BusinessAdd/BusinessDetails/styles.js +4 -0
  80. package/src/components/Stores/BusinessAdd/DeliveryZone/index.js +120 -109
  81. package/src/components/Stores/BusinessAdd/DeliveryZone/styles.js +22 -1
  82. package/src/components/Stores/BusinessAdd/PaymentMethods/index.js +8 -2
  83. package/src/components/Stores/BusinessAdd/PaymentMethods/styles.js +4 -0
  84. package/src/components/Stores/BusinessAdd/ReceiveOrders/index.js +11 -6
  85. package/src/components/Stores/BusinessAdd/ReceiveOrders/styles.js +4 -0
  86. package/src/components/Stores/BusinessAdd/index.js +47 -16
  87. package/src/components/Stores/BusinessAdd/styles.js +27 -1
  88. package/src/components/Stores/BusinessAddStore/index.js +1 -1
  89. package/src/components/Stores/BusinessBrandListing/index.js +37 -4
  90. package/src/components/Stores/BusinessDeliveryPickupMore/index.js +22 -1
  91. package/src/components/Stores/BusinessDeliveryZoneDetails/index.js +25 -2
  92. package/src/components/Stores/BusinessDeliveryZoneList/index.js +30 -3
  93. package/src/components/Stores/BusinessDetail/index.js +20 -1
  94. package/src/components/Stores/BusinessDetails/index.js +18 -1
  95. package/src/components/Stores/BusinessFrontLayout/index.js +13 -1
  96. package/src/components/Stores/BusinessFrontLayout/styles.js +11 -0
  97. package/src/components/Stores/BusinessMenu/index.js +56 -11
  98. package/src/components/Stores/BusinessMenuOptions/index.js +28 -3
  99. package/src/components/Stores/BusinessOrderingChannels/index.js +19 -2
  100. package/src/components/Stores/BusinessPaymentMethods/index.js +24 -2
  101. package/src/components/Stores/BusinessPlaceGroupList/index.js +193 -0
  102. package/src/components/Stores/BusinessPlaceGroupList/styles.js +143 -0
  103. package/src/components/Stores/BusinessProductsCategoyDetails/index.js +21 -1
  104. package/src/components/Stores/BusinessProductsListing/index.js +49 -8
  105. package/src/components/Stores/BusinessPromotionGeneralForm/index.js +2 -2
  106. package/src/components/Stores/BusinessSharedMenuProducts/index.js +29 -3
  107. package/src/components/Stores/BusinessSync/index.js +18 -2
  108. package/src/components/Stores/BusinessTypes/index.js +26 -4
  109. package/src/components/Stores/BusinessWalletsList/index.js +23 -1
  110. package/src/components/Stores/BusinessesListing/index.js +11 -2
  111. package/src/components/Stores/ImportersButton/index.js +24 -3
  112. package/src/components/Stores/PaymentOption/index.js +29 -8
  113. package/src/components/Stores/PaymentOptionMethods/index.js +25 -3
  114. package/src/components/Stores/PaymentOptionPaypal/index.js +25 -3
  115. package/src/components/Stores/PaymentOptionSquare/index.js +25 -3
  116. package/src/components/Stores/PaymentOptionStripeDirect/index.js +25 -3
  117. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +25 -3
  118. package/src/components/Stores/PaymethodOptionStripeConnect/index.js +25 -3
  119. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +25 -3
  120. package/src/components/Stores/ProductDetails/index.js +19 -1
  121. package/src/components/Stores/ProductExtras/index.js +23 -2
  122. package/src/components/Stores/ProductIngredient/index.js +23 -2
  123. package/src/components/Stores/ProductMainDetails/index.js +20 -2
  124. package/src/components/Stores/ProductTagsList/index.js +28 -3
  125. package/src/components/Users/CustomerCashWallet/index.js +25 -3
  126. package/src/components/Users/CustomerDetails/index.js +20 -1
  127. package/src/components/Users/CustomerPointsWallet/index.js +25 -3
  128. package/src/components/Users/CustomersListing/index.js +9 -4
  129. package/src/components/Users/ProfessionalDetail/index.js +27 -1
  130. package/src/components/Users/ProfessionalListing/index.js +9 -4
  131. package/src/components/Users/UserActiveStateFilter/index.js +16 -3
  132. package/src/components/Users/UserDetails/index.js +27 -1
  133. package/src/components/Users/UsersListing/index.js +9 -4
  134. package/template/pages/BusinessProductsList/index.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.14.3",
3
+ "version": "1.15.0",
4
4
  "description": "Ordering UI Admin Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -83,7 +83,7 @@
83
83
  "lodash": "^4.17.20",
84
84
  "moment": "^2.29.1",
85
85
  "moment-range": "^4.0.2",
86
- "ordering-components-admin-external": "1.14.1",
86
+ "ordering-components-admin-external": "1.15.0",
87
87
  "polished": "^3.6.7",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-big-calendar": "^1.4.2",
@@ -25,7 +25,7 @@ import {
25
25
 
26
26
  const BusinessReviewDetailsUI = (props) => {
27
27
  const {
28
- business,
28
+ businessState,
29
29
  reviewsList,
30
30
  handleOpenProducts,
31
31
  handleChangeReviewEnabled
@@ -43,18 +43,18 @@ const BusinessReviewDetailsUI = (props) => {
43
43
  <>
44
44
  <ReviewDetailsContainer>
45
45
  <Header>
46
- <h1>{business?.name}</h1>
46
+ <h1>{businessState.business?.name}</h1>
47
47
  <Button
48
48
  color='lightPrimary'
49
49
  borderRadius='8px'
50
- onClick={() => handleOpenProducts(business)}
50
+ onClick={() => handleOpenProducts(businessState.business)}
51
51
  >
52
52
  {t('PRODUCT_REVIEW', 'Product review')}
53
53
  </Button>
54
54
  </Header>
55
55
  <BusinessLogoContainer>
56
56
  <WrapperImage>
57
- <Image bgimage={optimizeImage(business?.logo || theme.images?.dummies?.businessLogo, 'h_120,c_limit')} />
57
+ <Image bgimage={optimizeImage(businessState.business?.logo || theme.images?.dummies?.businessLogo, 'h_120,c_limit')} />
58
58
  </WrapperImage>
59
59
  </BusinessLogoContainer>
60
60
  {reviewsList?.loading ? (
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, useUtils, DashboardBusinessList as BusinessListController } from 'ordering-components-admin-external'
3
4
  import Skeleton from 'react-loading-skeleton'
4
5
  import { useTheme } from 'styled-components'
@@ -27,12 +28,16 @@ const BusinessReviewsListingUI = (props) => {
27
28
  onSearch,
28
29
  handleOpenProducts
29
30
  } = props
31
+
32
+ const history = useHistory()
33
+ const query = new URLSearchParams(useLocation().search)
30
34
  const [, t] = useLanguage()
31
35
  const theme = useTheme()
32
36
  const [{ optimizeImage }] = useUtils()
33
37
  const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
34
38
  const [openReview, setOpenReview] = useState(false)
35
39
  const [curBusiness, setCurBusiness] = useState(null)
40
+ const [curBusinessId, setCurBusinessId] = useState(null)
36
41
 
37
42
  const handleChangePage = (page) => {
38
43
  getPageBusinesses(pagination.pageSize, page)
@@ -43,9 +48,14 @@ const BusinessReviewsListingUI = (props) => {
43
48
  getPageBusinesses(pageSize, expectedPage)
44
49
  }
45
50
 
46
- const handleOpenReview = (business) => {
51
+ const handleOpenReview = (business, isInitialRender) => {
47
52
  setCurBusiness(business)
53
+ setCurBusinessId(business.id)
48
54
  setOpenReview(true)
55
+ if (!isInitialRender) {
56
+ const tab = query.get('tab')
57
+ history.replace(`${location.pathname}?tab=${tab}&id=${business.id}`)
58
+ }
49
59
  }
50
60
 
51
61
  useEffect(() => {
@@ -53,6 +63,22 @@ const BusinessReviewsListingUI = (props) => {
53
63
  onSearch(parentSearchValue)
54
64
  }, [parentSearchValue])
55
65
 
66
+ const handleCloseReviewDetails = () => {
67
+ setCurBusiness(null)
68
+ setOpenReview(false)
69
+ const tab = query.get('tab')
70
+ history.replace(`${location.pathname}?tab=${tab}`)
71
+ }
72
+
73
+ useEffect(() => {
74
+ const tab = query.get('tab')
75
+ const id = query.get('id')
76
+ if (tab === 'business' && id) {
77
+ setCurBusinessId(Number(id))
78
+ setOpenReview(true)
79
+ }
80
+ }, [])
81
+
56
82
  return (
57
83
  <>
58
84
  <ReviewsTable>
@@ -134,15 +160,12 @@ const BusinessReviewsListingUI = (props) => {
134
160
  <SideBar
135
161
  defaultSideBarWidth={550}
136
162
  open={openReview}
137
- onClose={() => {
138
- setCurBusiness(null)
139
- setOpenReview(false)
140
- }}
163
+ onClose={() => handleCloseReviewDetails()}
141
164
  showExpandIcon
142
165
  >
143
166
  <BusinessReviewDetails
144
167
  business={curBusiness}
145
- businessId={curBusiness?.id}
168
+ businessId={curBusinessId}
146
169
  reviews={curBusiness?.reviews?.reviews}
147
170
  handleUpdateReview={handleUpdateReview}
148
171
  handleOpenProducts={handleOpenProducts}
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useRef, useState } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, useApi, InvoiceBusinessManager as InvoiceBusinessManagerController } from 'ordering-components-admin-external'
3
4
  import { DragScroll, SpinnerLoader } from '../../Shared'
4
5
  import {
@@ -23,6 +24,8 @@ const InvoiceBusinessManagerUI = (props) => {
23
24
  exportInvoiceList
24
25
  } = props
25
26
 
27
+ const history = useHistory()
28
+ const query = new URLSearchParams(useLocation().search)
26
29
  const [, t] = useLanguage()
27
30
  const [ordering] = useApi()
28
31
  const inputRef = useRef(null)
@@ -31,9 +34,13 @@ const InvoiceBusinessManagerUI = (props) => {
31
34
 
32
35
  const [selectedDetailType, setSelectedDetailType] = useState('general')
33
36
 
34
- const changeSelectedAnalyticsStatus = (detailType) => {
37
+ const changeSelectedAnalyticsStatus = (detailType, isInitialRender) => {
35
38
  window.scrollTo(0, 0)
36
39
  setSelectedDetailType(detailType)
40
+ if (!isInitialRender) {
41
+ const invoice = query.get('invoice')
42
+ history.replace(`${location.pathname}?invoice=${invoice}&tab=${detailType}`)
43
+ }
37
44
  }
38
45
 
39
46
  useEffect(() => {
@@ -42,6 +49,15 @@ const InvoiceBusinessManagerUI = (props) => {
42
49
  }
43
50
  }, [exportInvoiceList?.loading])
44
51
 
52
+ useEffect(() => {
53
+ const tab = query.get('tab')
54
+ if (tab) {
55
+ changeSelectedAnalyticsStatus(tab, true)
56
+ } else {
57
+ changeSelectedAnalyticsStatus(selectedDetailType)
58
+ }
59
+ }, [])
60
+
45
61
  return (
46
62
  <InvoiceDriversContainer>
47
63
  <DetailsHeader>
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useRef, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, useApi, InvoiceDriverManager as InvoiceDriverManagerController } from 'ordering-components-admin-external'
3
4
  import { DragScroll, SpinnerLoader } from '../../Shared'
4
5
  import {
@@ -21,6 +22,8 @@ const InvoiceDriverManagerUI = (props) => {
21
22
  exportInvoiceList
22
23
  } = props
23
24
 
25
+ const history = useHistory()
26
+ const query = new URLSearchParams(useLocation().search)
24
27
  const [, t] = useLanguage()
25
28
  const [ordering] = useApi()
26
29
  const [selectedDetailType, setSelectedDetailType] = useState('general')
@@ -28,9 +31,13 @@ const InvoiceDriverManagerUI = (props) => {
28
31
  const submitBtnRef = useRef(null)
29
32
  const invoicePdfRef = useRef(null)
30
33
 
31
- const changeSelectedAnalyticsStatus = (detailType) => {
34
+ const changeSelectedAnalyticsStatus = (detailType, isInitialRender) => {
32
35
  window.scrollTo(0, 0)
33
36
  setSelectedDetailType(detailType)
37
+ if (!isInitialRender) {
38
+ const invoice = query.get('invoice')
39
+ history.replace(`${location.pathname}?invoice=${invoice}&tab=${detailType}`)
40
+ }
34
41
  }
35
42
 
36
43
  useEffect(() => {
@@ -39,6 +46,15 @@ const InvoiceDriverManagerUI = (props) => {
39
46
  }
40
47
  }, [exportInvoiceList?.loading])
41
48
 
49
+ useEffect(() => {
50
+ const tab = query.get('tab')
51
+ if (tab) {
52
+ changeSelectedAnalyticsStatus(tab, true)
53
+ } else {
54
+ changeSelectedAnalyticsStatus(selectedDetailType)
55
+ }
56
+ }, [])
57
+
42
58
  return (
43
59
  <InvoiceDriversContainer>
44
60
  <DetailsHeader>
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import { useInfoShare } from '../../../contexts/InfoShareContext'
4
5
  import { IconButton } from '../../../styles'
@@ -20,6 +21,8 @@ import {
20
21
  } from './styles'
21
22
 
22
23
  export const InvoiceManager = (props) => {
24
+ const history = useHistory()
25
+ const query = new URLSearchParams(useLocation().search)
23
26
  const [, t] = useLanguage()
24
27
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
25
28
  const [openInvoiceDetail, setOpenInvoiceDetail] = useState(false)
@@ -30,16 +33,27 @@ export const InvoiceManager = (props) => {
30
33
  { id: 2, key: 'driver', name: t('DRIVER_INVOICE', 'Driver invoice'), icon: <DriverIcon />, description: t('DRIVER_INVOICE_DESCRIPTION', 'Driver invoice description') }
31
34
  ]
32
35
 
33
- const handleOpenInvoiceDetail = (index) => {
36
+ const handleOpenInvoiceDetail = (index, isInitialRender) => {
34
37
  setOpenInvoiceDetail(true)
35
38
  setSelectedInvoice(index)
39
+ if (!isInitialRender) {
40
+ history.replace(`${location.pathname}?invoice=${index}`)
41
+ }
36
42
  }
37
43
 
38
44
  const handleCloseInvoiceDetail = () => {
39
45
  setOpenInvoiceDetail(false)
40
46
  setSelectedInvoice(null)
47
+ history.replace(`${location.pathname}`)
41
48
  }
42
49
 
50
+ useEffect(() => {
51
+ const invoice = query.get('invoice')
52
+ if (invoice) {
53
+ handleOpenInvoiceDetail(invoice, true)
54
+ }
55
+ }, [])
56
+
43
57
  return (
44
58
  <>
45
59
  <InvoiceManagerContainer>
@@ -28,6 +28,7 @@ export const CheckboxWrapper = styled.div`
28
28
  export const ActionBtnWrapper = styled.div`
29
29
  position: sticky;
30
30
  top: 100%;
31
+ margin-top: 30px;
31
32
 
32
33
  > button {
33
34
  height: 44px;
@@ -18,7 +18,7 @@ import {
18
18
 
19
19
  const ProductReviewDetailsUI = (props) => {
20
20
  const {
21
- product,
21
+ productState,
22
22
  productReviewList
23
23
  } = props
24
24
 
@@ -29,12 +29,12 @@ const ProductReviewDetailsUI = (props) => {
29
29
  <>
30
30
  <ReviewDetailsContainer>
31
31
  <Header>
32
- <h1>{product?.name}</h1>
32
+ <h1>{productState.product?.name}</h1>
33
33
  </Header>
34
34
  <ProductImageContainer>
35
35
  <WrapperImage>
36
- {product?.images ? (
37
- <Image bgimage={optimizeImage(product?.images, 'h_120,c_limit')} />
36
+ {productState.product?.images ? (
37
+ <Image bgimage={optimizeImage(productState.product?.images, 'h_120,c_limit')} />
38
38
  ) : (
39
39
  <ImageFill />
40
40
  )}
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useInfoShare } from '../../../contexts/InfoShareContext'
3
4
  import { IconButton } from '../../../styles'
4
5
  import { useWindowSize } from '../../../hooks/useWindowSize'
@@ -56,6 +57,8 @@ import {
56
57
  } from './styles'
57
58
 
58
59
  export const Reports = (props) => {
60
+ const history = useHistory()
61
+ const query = new URLSearchParams(useLocation().search)
59
62
  const [, t] = useLanguage()
60
63
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
61
64
  const [isOpen, setIsOpen] = useState(false)
@@ -89,13 +92,24 @@ export const Reports = (props) => {
89
92
  const handleCloseSidebar = () => {
90
93
  setIsOpen(false)
91
94
  setSelectedReport(0)
95
+ history.replace(`${location.pathname}`)
92
96
  }
93
97
 
94
- const handleOpenSlider = (index) => {
98
+ const handleOpenSlider = (index, isInitialRender) => {
95
99
  setSelectedReport(index)
96
100
  setIsOpen(true)
101
+ if (!isInitialRender) {
102
+ history.replace(`${location.pathname}?id=${index}`)
103
+ }
97
104
  }
98
105
 
106
+ useEffect(() => {
107
+ const id = query.get('id')
108
+ if (id) {
109
+ handleOpenSlider(Number(id), true)
110
+ }
111
+ }, [])
112
+
99
113
  return (
100
114
  <ReportsContainer>
101
115
  <HeaderTitleContainer>
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, useUtils, ReviewProductList as ReviewProductListController } from 'ordering-components-admin-external'
3
4
  import { ImageFill, StarFill } from 'react-bootstrap-icons'
4
5
  import Skeleton from 'react-loading-skeleton'
@@ -25,11 +26,15 @@ export const ReviewProductsListingUI = (props) => {
25
26
  businessId
26
27
  } = props
27
28
 
29
+ const history = useHistory()
30
+ const query = new URLSearchParams(useLocation().search)
28
31
  const [, t] = useLanguage()
29
32
  const [{ optimizeImage }] = useUtils()
30
33
 
31
34
  const [openReview, setOpenReview] = useState(false)
32
35
  const [curProduct, setCurProduct] = useState(null)
36
+ const [curProductId, setCurProductId] = useState(null)
37
+ const [curCategoryId, setCurCategoryId] = useState(null)
33
38
 
34
39
  const [currentPage, setCurrentPage] = useState(1)
35
40
  const [productsPerPage, setProductsPerPage] = useState(10)
@@ -59,9 +64,24 @@ export const ReviewProductsListingUI = (props) => {
59
64
  setCurrentProducts(_currentProducts)
60
65
  }, [productState, currentPage, productsPerPage])
61
66
 
62
- const handleOpenReview = (product) => {
67
+ const handleOpenReview = (product, isInitialRender) => {
63
68
  setCurProduct(product)
69
+ setCurProductId(product?.id)
70
+ setCurCategoryId(product?.category?.id)
64
71
  setOpenReview(true)
72
+ if (!isInitialRender) {
73
+ const tab = query.get('tab')
74
+ const business = query.get('business')
75
+ history.replace(`${location.pathname}?tab=${tab}&business=${business}&category=${product?.category?.id}&product=${product.id}`)
76
+ }
77
+ }
78
+
79
+ const handleCloseReviewDetails = () => {
80
+ setCurProduct(null)
81
+ setOpenReview(false)
82
+ const tab = query.get('tab')
83
+ const business = query.get('business')
84
+ history.replace(`${location.pathname}?tab=${tab}&business=${business}`)
65
85
  }
66
86
 
67
87
  useEffect(() => {
@@ -72,6 +92,16 @@ export const ReviewProductsListingUI = (props) => {
72
92
  handleChangeSearch(parentSearchValue)
73
93
  }, [parentSearchValue])
74
94
 
95
+ useEffect(() => {
96
+ const category = query.get('category')
97
+ const product = query.get('product')
98
+ if (category && product) {
99
+ setCurCategoryId(Number(category))
100
+ setCurProductId(Number(product))
101
+ setOpenReview(true)
102
+ }
103
+ }, [])
104
+
75
105
  return (
76
106
  <>
77
107
  <ReviewsListingContainer>
@@ -154,15 +184,13 @@ export const ReviewProductsListingUI = (props) => {
154
184
  sidebarId='review-details'
155
185
  defaultSideBarWidth={550}
156
186
  open={openReview}
157
- onClose={() => {
158
- setCurProduct(null)
159
- setOpenReview(false)
160
- }}
187
+ onClose={() => handleCloseReviewDetails()}
161
188
  >
162
189
  <ProductReviewDetails
163
190
  businessId={businessId}
164
191
  product={curProduct}
165
- productId={curProduct?.id}
192
+ productId={curProductId}
193
+ categoryId={curCategoryId}
166
194
  />
167
195
  </SideBar>
168
196
  )}
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage } from 'ordering-components-admin-external'
3
4
  import { useInfoShare } from '../../../contexts/InfoShareContext'
4
5
  import { List as MenuIcon, CaretDownFill } from 'react-bootstrap-icons'
@@ -21,21 +22,30 @@ import {
21
22
  } from './styles'
22
23
 
23
24
  export const ReviewsListing = (props) => {
25
+ const history = useHistory()
26
+ const query = new URLSearchParams(useLocation().search)
24
27
  const [, t] = useLanguage()
25
28
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
26
29
  const [showOption, setShowOption] = useState('business')
27
30
  const [searchValue, setSearchValue] = useState(null)
28
31
  const [showSelect, setShowSelect] = useState(false)
29
32
  const [business, setBusiness] = useState('')
33
+ const [businessId, setBusinessId] = useState(null)
30
34
 
31
35
  const changeBusinessState = (business) => {
32
36
  setShowSelect(false)
33
37
  setBusiness(business)
38
+ setBusinessId(business.id)
39
+ const tab = query.get('tab')
40
+ history.replace(`${location.pathname}?tab=${tab}&business=${business.id}`)
34
41
  }
35
42
 
36
- const handleChangeOption = (option) => {
43
+ const handleChangeOption = (option, isInitialRender) => {
37
44
  setShowOption(option)
38
- if (option === 'products' && !business) setShowSelect(true)
45
+ if (option === 'products' && !businessId) setShowSelect(true)
46
+ if (!isInitialRender) {
47
+ history.replace(`${location.pathname}?tab=${option}`)
48
+ }
39
49
  }
40
50
 
41
51
  const handleOpenProducts = (business) => {
@@ -44,6 +54,22 @@ export const ReviewsListing = (props) => {
44
54
  setShowSelect(false)
45
55
  }
46
56
 
57
+ useEffect(() => {
58
+ const tab = query.get('tab')
59
+ if (tab) {
60
+ const businessId = query.get('business')
61
+ if (tab === 'products' && businessId) {
62
+ setShowOption('products')
63
+ setShowSelect(false)
64
+ setBusinessId(Number(businessId))
65
+ } else {
66
+ handleChangeOption(tab, true)
67
+ }
68
+ } else {
69
+ handleChangeOption(showOption)
70
+ }
71
+ }, [])
72
+
47
73
  return (
48
74
  <>
49
75
  <ReviewsListingContainer>
@@ -138,10 +164,10 @@ export const ReviewsListing = (props) => {
138
164
  parentSearchValue={searchValue}
139
165
  />
140
166
  )}
141
- {showOption === 'products' && business?.id && (
167
+ {showOption === 'products' && businessId && (
142
168
  <ReviewProductsListing
143
169
  parentSearchValue={searchValue}
144
- businessId={business?.id}
170
+ businessId={businessId}
145
171
  />
146
172
  )}
147
173
  </ReviewsListingContainer>
@@ -20,7 +20,7 @@ import {
20
20
 
21
21
  const UserReviewDetailsUI = (props) => {
22
22
  const {
23
- driver,
23
+ userState,
24
24
  userReviewState
25
25
  } = props
26
26
 
@@ -48,12 +48,12 @@ const UserReviewDetailsUI = (props) => {
48
48
  <>
49
49
  <ReviewDetailsContainer>
50
50
  <Header>
51
- <h1>{driver?.name} {driver?.lastname}</h1>
51
+ <h1>{userState.user?.name} {userState.user?.lastname}</h1>
52
52
  </Header>
53
53
  <DriverPhotoContainer>
54
54
  <WrapperImage>
55
- {driver?.photo ? (
56
- <Image bgimage={optimizeImage(driver?.photo, 'w_120,c_limit')} />
55
+ {userState.user?.photo ? (
56
+ <Image bgimage={optimizeImage(userState.user?.photo, 'w_120,c_limit')} />
57
57
  ) : (
58
58
  <PersonFill />
59
59
  )}
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import {
3
4
  useLanguage,
4
5
  useUtils,
@@ -30,11 +31,14 @@ const DriversReviewListUI = (props) => {
30
31
  defaultUserTypesSelected
31
32
  } = props
32
33
 
34
+ const history = useHistory()
35
+ const query = new URLSearchParams(useLocation().search)
33
36
  const [, t] = useLanguage()
34
37
  const [{ optimizeImage, parseNumber }] = useUtils()
35
38
 
36
39
  const [openReview, setOpenReview] = useState(false)
37
- const [curDriver, setCurDriver] = useState(null)
40
+ const [curUser, setCurUser] = useState(null)
41
+ const [curUserId, setCurUserId] = useState(null)
38
42
  const headerTitle = defaultUserTypesSelected.length === 1 && defaultUserTypesSelected[0] === 3 ? t('CUSTOMER', 'Customer') : defaultUserTypesSelected[0] === 8 ? t('PROFESSIONAL', 'Professional') : t('DRIVER', 'Driver')
39
43
 
40
44
  const handleChangePage = (page) => {
@@ -52,16 +56,36 @@ const DriversReviewListUI = (props) => {
52
56
  }, [parentSearchValue])
53
57
 
54
58
  const handleOpenReview = (user) => {
55
- setCurDriver(user)
59
+ setCurUser(user)
60
+ setCurUserId(user.id)
56
61
  setOpenReview(true)
57
62
  }
58
63
 
59
- const handleClickReview = (e, user) => {
60
- const isInvalid = e.target.closest('.review-enabled') || e.target.closest('.review-actions')
64
+ const handleClickReview = (e, user, isInitialRender) => {
65
+ const isInvalid = e?.target?.closest('.review-enabled') || e.target.closest('.review-actions')
61
66
  if (isInvalid) return
62
67
  handleOpenReview(user)
68
+ if (!isInitialRender) {
69
+ const tab = query.get('tab')
70
+ history.replace(`${location.pathname}?tab=${tab}&id=${user.id}`)
71
+ }
63
72
  }
64
73
 
74
+ const handleCloseReviewDetails = () => {
75
+ setCurUser(null)
76
+ setOpenReview(false)
77
+ const tab = query.get('tab')
78
+ history.replace(`${location.pathname}?tab=${tab}`)
79
+ }
80
+
81
+ useEffect(() => {
82
+ const id = query.get('id')
83
+ if (id) {
84
+ setCurUserId(Number(id))
85
+ setOpenReview(true)
86
+ }
87
+ }, [])
88
+
65
89
  return (
66
90
  <>
67
91
  <ReviewsTable>
@@ -94,7 +118,7 @@ const DriversReviewListUI = (props) => {
94
118
  usersList.users.map(user => (
95
119
  <ReviewTbody
96
120
  key={user.id}
97
- active={user.id === curDriver?.id}
121
+ active={user.id === curUser?.id}
98
122
  onClick={e => handleClickReview(e, user)}
99
123
  >
100
124
  <tr>
@@ -144,15 +168,12 @@ const DriversReviewListUI = (props) => {
144
168
  sidebarId='driver-review-details'
145
169
  defaultSideBarWidth={550}
146
170
  open={openReview}
147
- onClose={() => {
148
- setCurDriver(null)
149
- setOpenReview(false)
150
- }}
171
+ onClose={() => handleCloseReviewDetails()}
151
172
  showExpandIcon
152
173
  >
153
174
  <UserReviewDetails
154
- userId={curDriver?.id}
155
- driver={curDriver}
175
+ userId={curUserId}
176
+ user={curUser}
156
177
  />
157
178
  </SideBar>
158
179
  )}
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, RecoveryActionDetail as RecoveryActionDetailController } from 'ordering-components-admin-external'
3
4
  import { Alert, Confirm } from '../../Shared'
4
5
  import { Dropdown, DropdownButton } from 'react-bootstrap'
@@ -30,6 +31,8 @@ const RecoveryActionDetailUI = (props) => {
30
31
  handleDeleteRecoveryAction
31
32
  } = props
32
33
 
34
+ const history = useHistory()
35
+ const query = new URLSearchParams(useLocation().search)
33
36
  const theme = useTheme()
34
37
  const [, t] = useLanguage()
35
38
  const { width } = useWindowSize()
@@ -44,7 +47,7 @@ const RecoveryActionDetailUI = (props) => {
44
47
  { key: 'notifications', name: t('NOTIFICATIONS', 'Notifications') }
45
48
  ]
46
49
 
47
- const handleSelectOption = (key) => {
50
+ const handleSelectOption = (key, isInitialRender) => {
48
51
  if (key === 'notifications' && isAddMode) {
49
52
  setAlertState({
50
53
  open: true,
@@ -53,6 +56,10 @@ const RecoveryActionDetailUI = (props) => {
53
56
  return
54
57
  }
55
58
  setSelectedOption(key)
59
+ if (!isInitialRender) {
60
+ const id = query.get('id')
61
+ history.replace(`${location.pathname}?id=${id}&tab=${key}`)
62
+ }
56
63
  }
57
64
 
58
65
  const closeAlert = () => {
@@ -88,6 +95,16 @@ const RecoveryActionDetailUI = (props) => {
88
95
  })
89
96
  }, [actionState])
90
97
 
98
+ useEffect(() => {
99
+ if (Object.keys(recoveryActionState.action).length === 0) return
100
+ const tab = query.get('tab')
101
+ if (tab) {
102
+ handleSelectOption(tab, true)
103
+ } else {
104
+ handleSelectOption(selectedOption)
105
+ }
106
+ }, [recoveryActionState.action])
107
+
91
108
  return (
92
109
  <>
93
110
  <RecoveryActionDetailContainer>
@@ -151,6 +168,7 @@ const RecoveryActionDetailUI = (props) => {
151
168
  {selectedOption === 'notifications' && (
152
169
  <RecoveryNotificationList
153
170
  {...props}
171
+ action={recoveryActionState.action}
154
172
  />
155
173
  )}
156
174
  </RecoveryActionDetailContainer>