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.
- package/_bundles/{ordering-ui-admin.462f5c3aad7a320965e9.js → ordering-ui-admin.78f6259366a43cc634db.js} +2 -2
- package/_modules/components/BusinessIntelligence/AnalyticsCalendar/index.js +1 -0
- package/_modules/components/BusinessIntelligence/AnalyticsOrdersOrSales/index.js +40 -133
- package/_modules/components/BusinessIntelligence/BusinessReviewList/index.js +14 -6
- package/_modules/components/BusinessIntelligence/InvoiceBusinessManager/index.js +4 -3
- package/_modules/components/BusinessIntelligence/InvoiceDriverManager/index.js +4 -3
- package/_modules/components/BusinessIntelligence/InvoiceManager/index.js +5 -3
- package/_modules/components/BusinessIntelligence/Reports/ReportsSlaOrders/index.js +173 -0
- package/_modules/components/BusinessIntelligence/Reports/ReportsSlaOrders/styles.js +93 -0
- package/_modules/components/BusinessIntelligence/Reports/index.js +12 -4
- package/_modules/components/BusinessIntelligence/ReviewProductsListing/index.js +21 -10
- package/_modules/components/BusinessIntelligence/ReviewsListing/index.js +52 -12
- package/_modules/components/BusinessIntelligence/UsersReviewList/index.js +14 -6
- package/_modules/components/CartRecovery/OpenCartList/index.js +12 -3
- package/_modules/components/CartRecovery/OpenCartListing/index.js +16 -4
- package/_modules/components/CartRecovery/OpenCartsDetail/index.js +52 -2
- package/_modules/components/CartRecovery/OpenCartsDetail/styles.js +20 -3
- package/_modules/components/CartRecovery/RecoveryActionDetail/index.js +4 -3
- package/_modules/components/CartRecovery/RecoveryActionList/index.js +10 -1
- package/_modules/components/CartRecovery/RecoveryActionListing/index.js +15 -5
- package/_modules/components/Delivery/DeliveryUsersListing/index.js +19 -6
- package/_modules/components/Delivery/DriversCompaniesList/index.js +16 -3
- package/_modules/components/Delivery/DriversCompaniesListing/index.js +9 -5
- package/_modules/components/Delivery/DriversCompanyDetailsForm/index.js +4 -3
- package/_modules/components/Delivery/DriversGroupDetails/index.js +4 -3
- package/_modules/components/Delivery/DriversGroupLogistics/index.js +4 -4
- package/_modules/components/Delivery/DriversGroupsList/index.js +16 -3
- package/_modules/components/Delivery/DriversGroupsListing/index.js +9 -5
- package/_modules/components/Delivery/UserDetails/index.js +4 -8
- package/_modules/components/Delivery/UserFormDetails/index.js +9 -1
- package/_modules/components/Delivery/UsersList/index.js +10 -1
- package/_modules/components/Marketing/AdBannersListing/index.js +6 -3
- package/_modules/components/Marketing/CampaignDetail/index.js +4 -3
- package/_modules/components/Marketing/CampaignList/index.js +10 -1
- package/_modules/components/Marketing/CampaignListing/index.js +14 -4
- package/_modules/components/Marketing/EnterprisePromotionList/index.js +10 -1
- package/_modules/components/Marketing/EnterprisePromotionListing/index.js +14 -4
- package/_modules/components/Marketing/PageBanner/index.js +5 -5
- package/_modules/components/Messages/MessagesListing/index.js +15 -5
- package/_modules/components/MyProducts/AdvancedSettings/index.js +12 -0
- package/_modules/components/OrderingProducts/OrderingProductDetails/index.js +4 -2
- package/_modules/components/OrderingProducts/OrderingProductsListing/index.js +23 -5
- package/_modules/components/Orders/AllInOne/DriversManager/styles.js +1 -1
- package/_modules/components/Orders/AllInOne/index.js +7 -3
- package/_modules/components/Orders/AllInOne/styles.js +2 -2
- package/_modules/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +2 -16
- package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/index.js +26 -3
- package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +7 -2
- package/_modules/components/Orders/DeliveriesManager/index.js +4 -2
- package/_modules/components/Orders/DeliveryDashboard/index.js +4 -1
- package/_modules/components/Orders/DriverSelector/index.js +17 -5
- package/_modules/components/Orders/DriversDashboard/index.js +4 -2
- package/_modules/components/Orders/DriversLocation/index.js +70 -9
- package/_modules/components/Orders/DriversManager/index.js +5 -7
- package/_modules/components/Orders/DriversManager/styles.js +1 -1
- package/_modules/components/Orders/GiftCardsListing/index.js +46 -5
- package/_modules/components/Orders/Messages/index.js +4 -4
- package/_modules/components/Orders/OrderContactInformation/index.js +28 -20
- package/_modules/components/Orders/OrderDashboardSLASetting/index.js +1 -1
- package/_modules/components/Orders/OrderDetails/index.js +24 -13
- package/_modules/components/Orders/OrderStatusFilterBar/index.js +28 -5
- package/_modules/components/Orders/OrdersCards/index.js +10 -1
- package/_modules/components/Orders/OrdersDashboardControls/index.js +6 -2
- package/_modules/components/Orders/OrdersDashboardList/index.js +34 -4
- package/_modules/components/Orders/OrdersFilterGroup/styles.js +1 -1
- package/_modules/components/Orders/OrdersListing/index.js +6 -3
- package/_modules/components/Orders/OrdersManager/index.js +7 -2
- package/_modules/components/Orders/OrdersManager/styles.js +3 -3
- package/_modules/components/Orders/OrdersTable/index.js +9 -1
- package/_modules/components/Orders/OrdersTable/styles.js +1 -1
- package/_modules/components/Settings/Cms/index.js +14 -3
- package/_modules/components/Settings/LanguageManager/index.js +3 -1
- package/_modules/components/Settings/LanguageTransTable/index.js +14 -3
- package/_modules/components/Settings/SettingsList/index.js +1 -2
- package/_modules/components/Settings/WebhookDelaySelector/index.js +3 -0
- package/_modules/components/Settings/WebhookList/styles.js +1 -1
- package/_modules/components/Settings/WebhookListSelector/index.js +3 -0
- package/_modules/components/Shared/Pagination/index.js +1 -1
- package/_modules/components/Stores/BusinessActiveStateFilter/index.js +28 -5
- package/_modules/components/Stores/BusinessAdd/BusinessDetails/index.js +3 -2
- package/_modules/components/Stores/BusinessAdd/OrderTypePriceLevel/index.js +10 -5
- package/_modules/components/Stores/BusinessAdd/PaymentMethods/index.js +2 -1
- package/_modules/components/Stores/BusinessBrandListing/index.js +8 -5
- package/_modules/components/Stores/BusinessDeliveryPickupMore/index.js +4 -4
- package/_modules/components/Stores/BusinessDeliveryZoneDetails/index.js +4 -6
- package/_modules/components/Stores/BusinessDeliveryZoneList/index.js +5 -9
- package/_modules/components/Stores/BusinessDetail/index.js +4 -4
- package/_modules/components/Stores/BusinessDetails/index.js +5 -5
- package/_modules/components/Stores/BusinessDeviceListing/index.js +5 -4
- package/_modules/components/Stores/BusinessInformation/index.js +10 -6
- package/_modules/components/Stores/BusinessInformation/styles.js +1 -1
- package/_modules/components/Stores/BusinessMenu/index.js +8 -12
- package/_modules/components/Stores/BusinessMenuBasicOptions/index.js +8 -0
- package/_modules/components/Stores/BusinessMenuOptions/index.js +4 -6
- package/_modules/components/Stores/BusinessOrderingChannels/index.js +4 -4
- package/_modules/components/Stores/BusinessPaymentMethods/index.js +11 -7
- package/_modules/components/Stores/BusinessPlaceGroupList/index.js +5 -7
- package/_modules/components/Stores/BusinessPreorderDetails/index.js +13 -1
- package/_modules/components/Stores/BusinessProductList/index.js +1 -1
- package/_modules/components/Stores/BusinessProductsCategoyDetails/index.js +4 -3
- package/_modules/components/Stores/BusinessProductsListing/index.js +10 -6
- package/_modules/components/Stores/BusinessSharedMenuProducts/index.js +5 -11
- package/_modules/components/Stores/BusinessSync/index.js +4 -3
- package/_modules/components/Stores/BusinessTypes/index.js +5 -9
- package/_modules/components/Stores/BusinessWalletsList/index.js +5 -7
- package/_modules/components/Stores/BusinessWebhooks/index.js +12 -6
- package/_modules/components/Stores/BusinessesList/index.js +10 -1
- package/_modules/components/Stores/BusinessesListing/index.js +21 -6
- package/_modules/components/Stores/ImportersButton/index.js +5 -3
- package/_modules/components/Stores/PaymentOption/index.js +4 -5
- package/_modules/components/Stores/PaymentOptionMethods/index.js +4 -5
- package/_modules/components/Stores/PaymentOptionPaypal/index.js +4 -5
- package/_modules/components/Stores/PaymentOptionSquare/index.js +4 -5
- package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +4 -5
- package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +4 -5
- package/_modules/components/Stores/PaymethodOptionStripeConnect/index.js +4 -5
- package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +4 -5
- package/_modules/components/Stores/ProductDetails/index.js +5 -7
- package/_modules/components/Stores/ProductExtras/index.js +95 -23
- package/_modules/components/Stores/ProductExtras/styles.js +14 -8
- package/_modules/components/Stores/ProductIngredient/index.js +5 -9
- package/_modules/components/Stores/ProductMainDetails/index.js +4 -5
- package/_modules/components/Stores/ProductTagsList/index.js +5 -11
- package/_modules/components/Users/CustomerCashWallet/index.js +4 -5
- package/_modules/components/Users/CustomerDetails/index.js +21 -17
- package/_modules/components/Users/CustomerPointsWallet/index.js +4 -5
- package/_modules/components/Users/CustomersListing/index.js +17 -8
- package/_modules/components/Users/ProfessionalDetail/index.js +4 -9
- package/_modules/components/Users/ProfessionalList/index.js +10 -1
- package/_modules/components/Users/ProfessionalListing/index.js +17 -8
- package/_modules/components/Users/UserActiveStateFilter/index.js +7 -3
- package/_modules/components/Users/UserDetails/index.js +4 -9
- package/_modules/components/Users/UsersList/index.js +10 -1
- package/_modules/components/Users/UsersListing/index.js +17 -8
- package/_modules/index.js +12 -0
- package/_modules/utils/index.js +39 -2
- package/index-template.js +1 -1
- package/package.json +2 -2
- package/src/components/BusinessIntelligence/AnalyticsCalendar/index.js +4 -0
- package/src/components/BusinessIntelligence/AnalyticsOrdersOrSales/index.js +33 -123
- package/src/components/BusinessIntelligence/BusinessReviewList/index.js +13 -7
- package/src/components/BusinessIntelligence/InvoiceBusinessManager/index.js +3 -4
- package/src/components/BusinessIntelligence/InvoiceDriverManager/index.js +3 -4
- package/src/components/BusinessIntelligence/InvoiceManager/index.js +4 -4
- package/src/components/BusinessIntelligence/Reports/ReportsSlaOrders/index.js +200 -0
- package/src/components/BusinessIntelligence/Reports/ReportsSlaOrders/styles.js +239 -0
- package/src/components/BusinessIntelligence/Reports/index.js +10 -6
- package/src/components/BusinessIntelligence/ReviewProductsListing/index.js +23 -11
- package/src/components/BusinessIntelligence/ReviewsListing/index.js +54 -10
- package/src/components/BusinessIntelligence/UsersReviewList/index.js +14 -7
- package/src/components/CartRecovery/OpenCartList/index.js +15 -5
- package/src/components/CartRecovery/OpenCartListing/index.js +14 -3
- package/src/components/CartRecovery/OpenCartsDetail/index.js +44 -4
- package/src/components/CartRecovery/OpenCartsDetail/styles.js +54 -0
- package/src/components/CartRecovery/RecoveryActionDetail/index.js +3 -4
- package/src/components/CartRecovery/RecoveryActionList/index.js +12 -2
- package/src/components/CartRecovery/RecoveryActionListing/index.js +14 -6
- package/src/components/Delivery/DeliveryUsersListing/index.js +19 -8
- package/src/components/Delivery/DriversCompaniesList/index.js +17 -3
- package/src/components/Delivery/DriversCompaniesListing/index.js +7 -5
- package/src/components/Delivery/DriversCompanyDetailsForm/index.js +3 -4
- package/src/components/Delivery/DriversGroupDetails/index.js +3 -4
- package/src/components/Delivery/DriversGroupLogistics/index.js +3 -5
- package/src/components/Delivery/DriversGroupsList/index.js +17 -3
- package/src/components/Delivery/DriversGroupsListing/index.js +7 -5
- package/src/components/Delivery/UserDetails/index.js +4 -9
- package/src/components/Delivery/UserFormDetails/index.js +9 -0
- package/src/components/Delivery/UsersList/index.js +11 -1
- package/src/components/Marketing/AdBannersListing/index.js +5 -4
- package/src/components/Marketing/CampaignDetail/index.js +3 -4
- package/src/components/Marketing/CampaignList/index.js +12 -2
- package/src/components/Marketing/CampaignListing/index.js +14 -5
- package/src/components/Marketing/EnterprisePromotionList/index.js +11 -1
- package/src/components/Marketing/EnterprisePromotionListing/index.js +13 -5
- package/src/components/Marketing/PageBanner/index.js +5 -6
- package/src/components/Messages/MessagesListing/index.js +14 -5
- package/src/components/MyProducts/AdvancedSettings/index.js +4 -1
- package/src/components/OrderingProducts/OrderingProductDetails/index.js +4 -3
- package/src/components/OrderingProducts/OrderingProductsListing/index.js +23 -6
- package/src/components/Orders/AllInOne/DriversManager/styles.js +1 -1
- package/src/components/Orders/AllInOne/index.js +5 -1
- package/src/components/Orders/AllInOne/styles.js +6 -2
- package/src/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +4 -17
- package/src/components/Orders/CreateCustomOrder/SelectCustomer/index.js +23 -2
- package/src/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +22 -0
- package/src/components/Orders/DeliveriesManager/index.js +3 -1
- package/src/components/Orders/DeliveryDashboard/index.js +4 -1
- package/src/components/Orders/DriverSelector/index.js +8 -2
- package/src/components/Orders/DriversDashboard/index.js +3 -1
- package/src/components/Orders/DriversLocation/index.js +117 -43
- package/src/components/Orders/DriversManager/index.js +3 -2
- package/src/components/Orders/DriversManager/styles.js +1 -1
- package/src/components/Orders/GiftCardsListing/index.js +44 -5
- package/src/components/Orders/Messages/index.js +5 -5
- package/src/components/Orders/OrderContactInformation/index.js +13 -7
- package/src/components/Orders/OrderDashboardSLASetting/index.js +1 -1
- package/src/components/Orders/OrderDetails/index.js +16 -16
- package/src/components/Orders/OrderStatusFilterBar/index.js +19 -2
- package/src/components/Orders/OrdersCards/index.js +11 -1
- package/src/components/Orders/OrdersDashboardControls/index.js +8 -2
- package/src/components/Orders/OrdersDashboardList/index.js +34 -2
- package/src/components/Orders/OrdersFilterGroup/styles.js +1 -1
- package/src/components/Orders/OrdersListing/index.js +4 -1
- package/src/components/Orders/OrdersManager/index.js +6 -1
- package/src/components/Orders/OrdersManager/styles.js +4 -2
- package/src/components/Orders/OrdersTable/index.js +11 -2
- package/src/components/Orders/OrdersTable/styles.js +0 -6
- package/src/components/Settings/Cms/index.js +15 -2
- package/src/components/Settings/LanguageManager/index.js +5 -1
- package/src/components/Settings/LanguageTransTable/index.js +15 -2
- package/src/components/Settings/SettingsList/index.js +90 -94
- package/src/components/Settings/WebhookDelaySelector/index.js +3 -2
- package/src/components/Settings/WebhookList/styles.js +3 -0
- package/src/components/Settings/WebhookListSelector/index.js +1 -0
- package/src/components/Shared/Pagination/index.js +1 -1
- package/src/components/Stores/BusinessActiveStateFilter/index.js +24 -4
- package/src/components/Stores/BusinessAdd/BusinessDetails/index.js +1 -1
- package/src/components/Stores/BusinessAdd/OrderTypePriceLevel/index.js +9 -6
- package/src/components/Stores/BusinessAdd/PaymentMethods/index.js +1 -1
- package/src/components/Stores/BusinessBrandListing/index.js +6 -6
- package/src/components/Stores/BusinessDeliveryPickupMore/index.js +3 -5
- package/src/components/Stores/BusinessDeliveryZoneDetails/index.js +3 -7
- package/src/components/Stores/BusinessDeliveryZoneList/index.js +4 -11
- package/src/components/Stores/BusinessDetail/index.js +4 -5
- package/src/components/Stores/BusinessDetails/index.js +4 -6
- package/src/components/Stores/BusinessDeviceListing/index.js +4 -4
- package/src/components/Stores/BusinessInformation/index.js +8 -6
- package/src/components/Stores/BusinessInformation/styles.js +1 -0
- package/src/components/Stores/BusinessMenu/index.js +5 -13
- package/src/components/Stores/BusinessMenuBasicOptions/index.js +3 -2
- package/src/components/Stores/BusinessMenuOptions/index.js +3 -7
- package/src/components/Stores/BusinessOrderingChannels/index.js +3 -5
- package/src/components/Stores/BusinessPaymentMethods/index.js +7 -9
- package/src/components/Stores/BusinessPlaceGroupList/index.js +4 -8
- package/src/components/Stores/BusinessPreorderDetails/index.js +2 -2
- package/src/components/Stores/BusinessProductList/index.js +1 -1
- package/src/components/Stores/BusinessProductsCategoyDetails/index.js +3 -5
- package/src/components/Stores/BusinessProductsListing/index.js +9 -7
- package/src/components/Stores/BusinessSharedMenuProducts/index.js +4 -12
- package/src/components/Stores/BusinessSync/index.js +3 -4
- package/src/components/Stores/BusinessTypes/index.js +4 -11
- package/src/components/Stores/BusinessWalletsList/index.js +4 -8
- package/src/components/Stores/BusinessWebhooks/index.js +6 -4
- package/src/components/Stores/BusinessesList/index.js +11 -1
- package/src/components/Stores/BusinessesListing/index.js +21 -7
- package/src/components/Stores/ImportersButton/index.js +4 -5
- package/src/components/Stores/PaymentOption/index.js +3 -6
- package/src/components/Stores/PaymentOptionMethods/index.js +3 -6
- package/src/components/Stores/PaymentOptionPaypal/index.js +3 -6
- package/src/components/Stores/PaymentOptionSquare/index.js +3 -6
- package/src/components/Stores/PaymentOptionStripeDirect/index.js +3 -6
- package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +3 -6
- package/src/components/Stores/PaymethodOptionStripeConnect/index.js +3 -6
- package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +3 -6
- package/src/components/Stores/ProductDetails/index.js +5 -8
- package/src/components/Stores/ProductExtras/index.js +65 -14
- package/src/components/Stores/ProductExtras/styles.js +41 -1
- package/src/components/Stores/ProductIngredient/index.js +4 -10
- package/src/components/Stores/ProductMainDetails/index.js +4 -6
- package/src/components/Stores/ProductTagsList/index.js +4 -12
- package/src/components/Users/CustomerCashWallet/index.js +3 -6
- package/src/components/Users/CustomerDetails/index.js +13 -11
- package/src/components/Users/CustomerPointsWallet/index.js +3 -6
- package/src/components/Users/CustomersListing/index.js +15 -8
- package/src/components/Users/ProfessionalDetail/index.js +3 -10
- package/src/components/Users/ProfessionalList/index.js +11 -1
- package/src/components/Users/ProfessionalListing/index.js +15 -8
- package/src/components/Users/UserActiveStateFilter/index.js +5 -4
- package/src/components/Users/UserDetails/index.js +3 -10
- package/src/components/Users/UsersList/index.js +11 -1
- package/src/components/Users/UsersListing/index.js +15 -8
- package/src/index.js +3 -1
- package/src/utils/index.js +27 -0
- package/template/pages/AllInOne/index.js +4 -4
- package/template/pages/BusinessesList/index.js +4 -4
- package/template/pages/CampaignListing/index.js +5 -1
- package/template/pages/CustomersList/index.js +5 -4
- package/template/pages/DeliveriesManager/index.js +5 -4
- package/template/pages/DeliveryDriversList/index.js +5 -4
- package/template/pages/DriversCompaniesList/index.js +5 -1
- package/template/pages/DriversGroupsList/index.js +5 -1
- package/template/pages/DriversManagersList/index.js +5 -4
- package/template/pages/EnterprisePromotionList/index.js +1 -0
- package/template/pages/GiftCardsList/index.js +5 -1
- package/template/pages/ManagersList/index.js +5 -4
- package/template/pages/MessagesList/index.js +5 -1
- package/template/pages/OpenCarts/index.js +4 -5
- package/template/pages/OrderingProducts/index.js +2 -1
- package/template/pages/OrdersList/index.js +4 -4
- package/template/pages/Professionals/index.js +5 -4
- package/template/pages/RecoveryActionListing/index.js +5 -1
- package/template/pages/ReviewsList/index.js +5 -1
- /package/_bundles/{ordering-ui-admin.462f5c3aad7a320965e9.js.LICENSE.txt → ordering-ui-admin.78f6259366a43cc634db.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import React, { useRef } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
useLanguage,
|
|
4
|
+
useUtils,
|
|
5
|
+
AdvancedReports as AdvancedReportsController
|
|
6
|
+
} from 'ordering-components-admin-external'
|
|
7
|
+
|
|
8
|
+
import { AnalyticsCalendar } from '../../AnalyticsCalendar'
|
|
9
|
+
import { Download } from 'react-bootstrap-icons'
|
|
10
|
+
import Skeleton from 'react-loading-skeleton'
|
|
11
|
+
import { AnalyticsFilterTimeZone } from '../../AnalyticsFilterTimeZone'
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
ReportsContainer,
|
|
15
|
+
ReportsTableContainer,
|
|
16
|
+
TitleBlock,
|
|
17
|
+
ButtonActionList,
|
|
18
|
+
CalendarWrapper,
|
|
19
|
+
ReportsTable,
|
|
20
|
+
TableWrapper,
|
|
21
|
+
EmptyContent,
|
|
22
|
+
Title,
|
|
23
|
+
Thead,
|
|
24
|
+
Tbody,
|
|
25
|
+
Tfoot,
|
|
26
|
+
AnalyticsTimeZoneWrapper,
|
|
27
|
+
TimeZoneAndCalendar
|
|
28
|
+
} from './styles'
|
|
29
|
+
|
|
30
|
+
const ReportsSlaOrdersUI = (props) => {
|
|
31
|
+
const {
|
|
32
|
+
filterList,
|
|
33
|
+
handleChangeFilterList,
|
|
34
|
+
reportData
|
|
35
|
+
} = props
|
|
36
|
+
|
|
37
|
+
const [, t] = useLanguage()
|
|
38
|
+
const [{ parsePrice }] = useUtils()
|
|
39
|
+
|
|
40
|
+
const tableRef = useRef(null)
|
|
41
|
+
|
|
42
|
+
const handleChangeDate = (date1, date2) => {
|
|
43
|
+
handleChangeFilterList({ ...filterList, from: date1, to: date2 })
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const downloadCSV = () => {
|
|
47
|
+
if (reportData?.content?.body?.rows?.length === 0) return
|
|
48
|
+
let csv = ''
|
|
49
|
+
reportData.content.header.rows.forEach((tr) => {
|
|
50
|
+
tr.forEach((th) => {
|
|
51
|
+
csv += `${th.value},`
|
|
52
|
+
for (let i = 1; i < th.colspan; i++) {
|
|
53
|
+
csv += ' ,'
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
csv += '\n'
|
|
57
|
+
})
|
|
58
|
+
csv += '\n'
|
|
59
|
+
reportData.content.body.rows.forEach((tr) => {
|
|
60
|
+
tr.forEach((th) => {
|
|
61
|
+
csv += `${th.value},`
|
|
62
|
+
for (let i = 1; i < th.colspan; i++) {
|
|
63
|
+
csv += ' ,'
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
csv += '\n'
|
|
67
|
+
})
|
|
68
|
+
csv += '\n'
|
|
69
|
+
reportData.content.footer.rows.forEach((tr) => {
|
|
70
|
+
tr.forEach((th) => {
|
|
71
|
+
csv += `${th.value},`
|
|
72
|
+
for (let i = 1; i < th.colspan; i++) {
|
|
73
|
+
csv += ' ,'
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
csv += '\n'
|
|
77
|
+
})
|
|
78
|
+
csv += '\n'
|
|
79
|
+
var downloadLink = document.createElement('a')
|
|
80
|
+
var blob = new Blob(['\ufeff', csv])
|
|
81
|
+
var url = URL.createObjectURL(blob)
|
|
82
|
+
downloadLink.href = url
|
|
83
|
+
const fileSuffix = new Date().getTime()
|
|
84
|
+
downloadLink.download = `completed_orders_${fileSuffix}.csv`
|
|
85
|
+
document.body.appendChild(downloadLink)
|
|
86
|
+
downloadLink.click()
|
|
87
|
+
document.body.removeChild(downloadLink)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const convertHMS = (value) => {
|
|
91
|
+
const sec = parseInt(value, 10) // convert value to number if it's string
|
|
92
|
+
let hours = Math.floor(sec / 3600) // get hours
|
|
93
|
+
let minutes = Math.floor((sec - (hours * 3600)) / 60) // get minutes
|
|
94
|
+
let seconds = sec - (hours * 3600) - (minutes * 60) // get seconds
|
|
95
|
+
// add 0 if value < 10; Example: 2 => 02
|
|
96
|
+
if (hours < 10) { hours = '0' + hours }
|
|
97
|
+
if (minutes < 10) { minutes = '0' + minutes }
|
|
98
|
+
if (seconds < 10) { seconds = '0' + seconds }
|
|
99
|
+
return hours + ':' + minutes + ':' + seconds // Return is HH : MM : SS
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const thObj = {
|
|
103
|
+
REPORT_HEADER_IN_TIME: t('OK', 'Ok'),
|
|
104
|
+
REPORT_HEADER_AT_RISK: t('AT_RISK', 'At Risk'),
|
|
105
|
+
REPORT_HEADER_DELAYED: t('DELAYED', 'Delayed'),
|
|
106
|
+
REPORT_HEADER_STATUS: t('STATUS', 'Status')
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<ReportsContainer>
|
|
111
|
+
<Title>{t('SLA_ORDERS', 'SLA orders')}</Title>
|
|
112
|
+
<ButtonActionList>
|
|
113
|
+
<TimeZoneAndCalendar>
|
|
114
|
+
<AnalyticsTimeZoneWrapper>
|
|
115
|
+
<AnalyticsFilterTimeZone {...props} />
|
|
116
|
+
</AnalyticsTimeZoneWrapper>
|
|
117
|
+
<CalendarWrapper>
|
|
118
|
+
<AnalyticsCalendar
|
|
119
|
+
handleChangeDate={handleChangeDate}
|
|
120
|
+
defaultValue={filterList}
|
|
121
|
+
/>
|
|
122
|
+
</CalendarWrapper>
|
|
123
|
+
</TimeZoneAndCalendar>
|
|
124
|
+
</ButtonActionList>
|
|
125
|
+
<ReportsTableContainer>
|
|
126
|
+
<TitleBlock active={reportData?.content?.body?.rows?.length > 0}>
|
|
127
|
+
<h2>{t('SLA_ORDERS', 'SLA orders')}</h2>
|
|
128
|
+
<Download onClick={() => downloadCSV()} />
|
|
129
|
+
</TitleBlock>
|
|
130
|
+
{reportData?.loading ? (
|
|
131
|
+
<div className='row'>
|
|
132
|
+
{[...Array(20).keys()].map(i => (
|
|
133
|
+
<div className='col-md-3 col-sm-3 col-3' key={i}><Skeleton /></div>
|
|
134
|
+
))}
|
|
135
|
+
</div>
|
|
136
|
+
) : (
|
|
137
|
+
<TableWrapper>
|
|
138
|
+
{reportData?.content?.body?.rows?.length > 0 ? (
|
|
139
|
+
<ReportsTable ref={tableRef}>
|
|
140
|
+
{reportData?.content?.header?.rows.length > 0 && (
|
|
141
|
+
<Thead>
|
|
142
|
+
{
|
|
143
|
+
reportData?.content?.header?.rows.map((tr, i) => (
|
|
144
|
+
<tr key={i}>
|
|
145
|
+
{tr?.map((th, j) => (
|
|
146
|
+
<th key={j} colSpan={th.colspan}>{t(th.value.toUpperCase(), thObj[th.value])}</th>
|
|
147
|
+
))}
|
|
148
|
+
</tr>
|
|
149
|
+
))
|
|
150
|
+
}
|
|
151
|
+
</Thead>
|
|
152
|
+
)}
|
|
153
|
+
{reportData?.content?.body?.rows.map((tbody, i) => (
|
|
154
|
+
<Tbody key={i}>
|
|
155
|
+
<tr>
|
|
156
|
+
{tbody.map((td, j) => (
|
|
157
|
+
<td key={j} colSpan={td.colspan}>
|
|
158
|
+
{(td.value_unit === 'seconds' && td.value)
|
|
159
|
+
? convertHMS(td.value)
|
|
160
|
+
: (td.value_unit === 'currency'
|
|
161
|
+
? parsePrice(td.value)
|
|
162
|
+
: td.value
|
|
163
|
+
)}
|
|
164
|
+
</td>
|
|
165
|
+
))}
|
|
166
|
+
</tr>
|
|
167
|
+
</Tbody>
|
|
168
|
+
))}
|
|
169
|
+
{reportData?.content?.footer?.rows.length > 0 && (
|
|
170
|
+
<Tfoot>
|
|
171
|
+
{
|
|
172
|
+
reportData?.content?.footer?.rows.map((tr, i) => (
|
|
173
|
+
<tr key={i}>
|
|
174
|
+
{tr?.map((td, j) => (
|
|
175
|
+
<td key={j} colSpan={td.colspan}>{td.value}</td>
|
|
176
|
+
))}
|
|
177
|
+
</tr>
|
|
178
|
+
))
|
|
179
|
+
}
|
|
180
|
+
</Tfoot>
|
|
181
|
+
)}
|
|
182
|
+
</ReportsTable>
|
|
183
|
+
) : (
|
|
184
|
+
<EmptyContent>{t('NO_DATA', 'No Data')}</EmptyContent>
|
|
185
|
+
)}
|
|
186
|
+
</TableWrapper>
|
|
187
|
+
)}
|
|
188
|
+
</ReportsTableContainer>
|
|
189
|
+
</ReportsContainer>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export const ReportsSlaOrders = (props) => {
|
|
194
|
+
const reportsSlaOrdersProps = {
|
|
195
|
+
...props,
|
|
196
|
+
UIComponent: ReportsSlaOrdersUI,
|
|
197
|
+
endpoint: 'sla_orders'
|
|
198
|
+
}
|
|
199
|
+
return <AdvancedReportsController {...reportsSlaOrdersProps} />
|
|
200
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const ReportsContainer = styled.div`
|
|
4
|
+
padding: 25px 15px 70px 15px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
overflow: auto;
|
|
7
|
+
|
|
8
|
+
@media (min-width: 700px) {
|
|
9
|
+
padding: 25px 35px 70px 35px;
|
|
10
|
+
}
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export const Title = styled.h2`
|
|
14
|
+
font-weight: bold;
|
|
15
|
+
font-size: 20px;
|
|
16
|
+
color: ${props => props.theme?.colors.headingColor};
|
|
17
|
+
margin-top: 0;
|
|
18
|
+
margin-bottom: 30px;
|
|
19
|
+
margin-right: 35px;
|
|
20
|
+
${props => props.theme?.rtl && css`
|
|
21
|
+
margin-right: 0;
|
|
22
|
+
margin-left: 35px;
|
|
23
|
+
`}
|
|
24
|
+
`
|
|
25
|
+
|
|
26
|
+
export const ButtonActionList = styled.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: flex-end;
|
|
31
|
+
`
|
|
32
|
+
|
|
33
|
+
export const CalendarWrapper = styled.div`
|
|
34
|
+
position: relative;
|
|
35
|
+
|
|
36
|
+
> button {
|
|
37
|
+
margin-top: 5px;
|
|
38
|
+
padding: 7px 15px;
|
|
39
|
+
color: ${props => props.theme?.colors.secundaryContrast};
|
|
40
|
+
background: ${props => props.theme?.colors.secundary};
|
|
41
|
+
border-radius: 7.6px;
|
|
42
|
+
border: none;
|
|
43
|
+
text-align: left;
|
|
44
|
+
margin-left: 10px;
|
|
45
|
+
|
|
46
|
+
${props => props.theme?.rtl && css`
|
|
47
|
+
margin-right: 10px;
|
|
48
|
+
margin-left: 0;
|
|
49
|
+
`}
|
|
50
|
+
|
|
51
|
+
svg {
|
|
52
|
+
font-size: 16px;
|
|
53
|
+
margin-right: 12px;
|
|
54
|
+
|
|
55
|
+
${props => props.theme.rtl && css`
|
|
56
|
+
margin-right: 0px;
|
|
57
|
+
margin-left: 12px;
|
|
58
|
+
`}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media only screen and (min-width: 374px) and (max-width: 450px) {
|
|
63
|
+
.ordering-calendar {
|
|
64
|
+
right: calc((100vw - 364px) / 2);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media (max-width: 450px) {
|
|
69
|
+
width: 100%;
|
|
70
|
+
flex-wrap: wrap;
|
|
71
|
+
> button {
|
|
72
|
+
width: 100%;
|
|
73
|
+
margin-left: 0 !important;
|
|
74
|
+
margin-right: 0 !important;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
`
|
|
78
|
+
|
|
79
|
+
export const ReportsTableContainer = styled.div`
|
|
80
|
+
width: 100%;
|
|
81
|
+
margin-top: 25px;
|
|
82
|
+
padding: 20px;
|
|
83
|
+
box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.1);
|
|
84
|
+
border-radius: 7.6px;
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
export const TitleBlock = styled.div`
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: space-between;
|
|
91
|
+
margin-bottom: 20px;
|
|
92
|
+
|
|
93
|
+
h2 {
|
|
94
|
+
font-weight: 600;
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
margin: 0;
|
|
97
|
+
text-transform: uppercase;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
svg {
|
|
101
|
+
font-size: 16px;
|
|
102
|
+
color: #212121;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
${({ active }) => !active && css`
|
|
107
|
+
svg {
|
|
108
|
+
cursor: not-allowed;
|
|
109
|
+
}
|
|
110
|
+
`}
|
|
111
|
+
`
|
|
112
|
+
|
|
113
|
+
export const ReportsTable = styled.table`
|
|
114
|
+
width: 100%;
|
|
115
|
+
min-width: 500px;
|
|
116
|
+
`
|
|
117
|
+
|
|
118
|
+
export const Thead = styled.thead`
|
|
119
|
+
position: sticky;
|
|
120
|
+
top: 0px;
|
|
121
|
+
background: ${props => props.theme.colors?.backgroundPage || '#FFF'};
|
|
122
|
+
border-bottom: 1px solid ${props => props.theme?.colors.secundaryDarkContrast};
|
|
123
|
+
|
|
124
|
+
tr {
|
|
125
|
+
th {
|
|
126
|
+
padding: 12px 5px;
|
|
127
|
+
font-weight: 500;
|
|
128
|
+
font-size: 12px;
|
|
129
|
+
text-transform: uppercase;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&:first-child {
|
|
133
|
+
th {
|
|
134
|
+
text-align: center;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&:nth-child(2) {
|
|
139
|
+
th {
|
|
140
|
+
text-align: center;
|
|
141
|
+
&:nth-child(3n-1) {
|
|
142
|
+
border-left: 1px solid ${props => props.theme?.colors.secundaryDarkContrast};
|
|
143
|
+
}
|
|
144
|
+
&:first-child, &:nth-child(2) {
|
|
145
|
+
border: none;
|
|
146
|
+
}
|
|
147
|
+
&:first-child {
|
|
148
|
+
border-right: 1px solid ${props => props.theme?.colors.secundaryDarkContrast};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
`
|
|
154
|
+
|
|
155
|
+
export const Tbody = styled.tbody`
|
|
156
|
+
border-bottom: 1px solid ${props => props.theme?.colors.secundaryDarkContrast};
|
|
157
|
+
|
|
158
|
+
tr {
|
|
159
|
+
td {
|
|
160
|
+
padding: 12px 5px;
|
|
161
|
+
font-size: 12px;
|
|
162
|
+
text-align: center;
|
|
163
|
+
color: ${props => props.theme?.colors.lightGray};
|
|
164
|
+
white-space: nowrap;
|
|
165
|
+
|
|
166
|
+
&:nth-child(3n-1) {
|
|
167
|
+
border-left: 1px solid ${props => props.theme?.colors.secundaryDarkContrast};
|
|
168
|
+
}
|
|
169
|
+
&:first-child, &:nth-child(2) {
|
|
170
|
+
color: ${props => props.theme?.colors.headingColor};
|
|
171
|
+
border: none;
|
|
172
|
+
}
|
|
173
|
+
&:first-child {
|
|
174
|
+
border-right: 1px solid ${props => props.theme?.colors.secundaryDarkContrast};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
`
|
|
179
|
+
|
|
180
|
+
export const Tfoot = styled.tfoot`
|
|
181
|
+
tr {
|
|
182
|
+
td {
|
|
183
|
+
font-weight: 500;
|
|
184
|
+
font-size: 12px;
|
|
185
|
+
padding: 12px 0;
|
|
186
|
+
|
|
187
|
+
&:not(:first-child) {
|
|
188
|
+
text-align: center;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
`
|
|
193
|
+
|
|
194
|
+
export const TableWrapper = styled.div`
|
|
195
|
+
width: 100%;
|
|
196
|
+
overflow: auto;
|
|
197
|
+
max-height: 650px;
|
|
198
|
+
`
|
|
199
|
+
|
|
200
|
+
export const EmptyContent = styled.div`
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
padding: 10px;
|
|
205
|
+
`
|
|
206
|
+
|
|
207
|
+
export const AnalyticsTimeZoneWrapper = styled.div`
|
|
208
|
+
width: 100%;
|
|
209
|
+
button {
|
|
210
|
+
margin-top: 5px;
|
|
211
|
+
background: ${props => props.theme.colors.secundary};
|
|
212
|
+
border-radius: 7.6px;
|
|
213
|
+
padding: 7px 15px;
|
|
214
|
+
font-size: 14px;
|
|
215
|
+
color: ${props => props.theme.colors.secundaryContrast};
|
|
216
|
+
border: none;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@media (min-width: 600px) {
|
|
220
|
+
width: fit-content;
|
|
221
|
+
margin-left: 10px;
|
|
222
|
+
${props => props.theme.rtl && css`
|
|
223
|
+
margin-right: 10px;
|
|
224
|
+
margin-left: 0;
|
|
225
|
+
`}
|
|
226
|
+
}
|
|
227
|
+
`
|
|
228
|
+
|
|
229
|
+
export const TimeZoneAndCalendar = styled.div`
|
|
230
|
+
display: flex;
|
|
231
|
+
align-items: center;
|
|
232
|
+
flex-direction: column;
|
|
233
|
+
width: 100%;
|
|
234
|
+
|
|
235
|
+
@media (min-width: 600px) {
|
|
236
|
+
flex-direction: row;
|
|
237
|
+
width: fit-content;
|
|
238
|
+
}
|
|
239
|
+
`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { useLocation } from 'react-router-dom'
|
|
3
3
|
import { useInfoShare } from '../../../contexts/InfoShareContext'
|
|
4
4
|
import { IconButton } from '../../../styles'
|
|
5
5
|
import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
@@ -24,7 +24,8 @@ import {
|
|
|
24
24
|
CreditCard,
|
|
25
25
|
ShopWindow,
|
|
26
26
|
Bag,
|
|
27
|
-
Tag
|
|
27
|
+
Tag,
|
|
28
|
+
ListTask
|
|
28
29
|
} from 'react-bootstrap-icons'
|
|
29
30
|
import { useLanguage } from 'ordering-components-admin-external'
|
|
30
31
|
import { SideBar } from '../../Shared'
|
|
@@ -49,6 +50,8 @@ import { ReportsPaymethodSales } from '../ReportsPaymethodSales'
|
|
|
49
50
|
import { ReportsSaleAndCategory } from '../ReportsSaleAndCategory'
|
|
50
51
|
import { ReportsAverageSales } from '../ReportsAverageSales'
|
|
51
52
|
import { ReportsGeneralSales } from '../ReportsGeneralSales'
|
|
53
|
+
import { ReportsSlaOrders } from './ReportsSlaOrders'
|
|
54
|
+
import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
|
|
52
55
|
|
|
53
56
|
import {
|
|
54
57
|
ReportsContainer,
|
|
@@ -57,7 +60,6 @@ import {
|
|
|
57
60
|
} from './styles'
|
|
58
61
|
|
|
59
62
|
export const Reports = (props) => {
|
|
60
|
-
const history = useHistory()
|
|
61
63
|
const query = new URLSearchParams(useLocation().search)
|
|
62
64
|
const [, t] = useLanguage()
|
|
63
65
|
const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
|
|
@@ -86,20 +88,21 @@ export const Reports = (props) => {
|
|
|
86
88
|
{ id: 17, name: t('PAYMETHOD_SALES', 'Paymethod sales'), description: t('PAYMETHOD_SALES_DESC', 'Paymethod sales description'), icon: <CreditCard /> },
|
|
87
89
|
{ id: 18, name: t('AVERAGE_SALES', 'Average sales'), description: t('AVERAGE_SALES_DESC', 'Average sales description'), icon: <ShopWindow /> },
|
|
88
90
|
{ id: 19, name: t('GENERAL_SALES', 'General sales'), description: t('GENERAL_SALES_DESC', 'General sales description'), icon: <Bag /> },
|
|
89
|
-
{ id: 20, name: t('TOP_SELLING_AND_CATEOGRY', 'Top selling and category'), description: t('TOP_SELLING_AND_CATEOGRY_DESC', 'Top selling and category description'), icon: <Tag /> }
|
|
91
|
+
{ id: 20, name: t('TOP_SELLING_AND_CATEOGRY', 'Top selling and category'), description: t('TOP_SELLING_AND_CATEOGRY_DESC', 'Top selling and category description'), icon: <Tag /> },
|
|
92
|
+
{ id: 21, name: t('SLA_ORDERS', 'SLA orders'), description: t('SLA_ORDERS_DESC', 'SLA orders description'), icon: <ListTask /> }
|
|
90
93
|
]
|
|
91
94
|
|
|
92
95
|
const handleCloseSidebar = () => {
|
|
93
96
|
setIsOpen(false)
|
|
94
97
|
setSelectedReport(0)
|
|
95
|
-
|
|
98
|
+
removeQueryToUrl(['id'])
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
const handleOpenSlider = (index, isInitialRender) => {
|
|
99
102
|
setSelectedReport(index)
|
|
100
103
|
setIsOpen(true)
|
|
101
104
|
if (!isInitialRender) {
|
|
102
|
-
|
|
105
|
+
addQueryToUrl({ id: index })
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
|
|
@@ -167,6 +170,7 @@ export const Reports = (props) => {
|
|
|
167
170
|
{selectedReport === 18 && <ReportsAverageSales />}
|
|
168
171
|
{selectedReport === 19 && <ReportsGeneralSales />}
|
|
169
172
|
{selectedReport === 20 && <ReportsSaleAndCategory />}
|
|
173
|
+
{selectedReport === 21 && <ReportsSlaOrders />}
|
|
170
174
|
</SideBar>
|
|
171
175
|
)}
|
|
172
176
|
</ReportsContainer>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { useLocation } from 'react-router-dom'
|
|
3
3
|
import { useLanguage, useUtils, ReviewProductList as ReviewProductListController } from 'ordering-components-admin-external'
|
|
4
4
|
import { ImageFill, StarFill } from 'react-bootstrap-icons'
|
|
5
5
|
import Skeleton from 'react-loading-skeleton'
|
|
6
6
|
import { Pagination, SideBar } from '../../Shared'
|
|
7
7
|
import { ProductReviewDetails } from '../ProductReviewDetails'
|
|
8
|
+
import { addQueryToUrl, removeQueryToUrl } from '../../../utils'
|
|
8
9
|
|
|
9
10
|
import {
|
|
10
11
|
ReviewsListingContainer,
|
|
@@ -23,10 +24,13 @@ export const ReviewProductsListingUI = (props) => {
|
|
|
23
24
|
handleChangeSearch,
|
|
24
25
|
searchValue,
|
|
25
26
|
parentSearchValue,
|
|
26
|
-
businessId
|
|
27
|
+
businessId,
|
|
28
|
+
isUseQuery,
|
|
29
|
+
defaultPage,
|
|
30
|
+
defaultPageSize,
|
|
31
|
+
firstRender
|
|
27
32
|
} = props
|
|
28
33
|
|
|
29
|
-
const history = useHistory()
|
|
30
34
|
const query = new URLSearchParams(useLocation().search)
|
|
31
35
|
const [, t] = useLanguage()
|
|
32
36
|
const [{ optimizeImage }] = useUtils()
|
|
@@ -36,8 +40,8 @@ export const ReviewProductsListingUI = (props) => {
|
|
|
36
40
|
const [curProductId, setCurProductId] = useState(null)
|
|
37
41
|
const [curCategoryId, setCurCategoryId] = useState(null)
|
|
38
42
|
|
|
39
|
-
const [currentPage, setCurrentPage] = useState(1)
|
|
40
|
-
const [productsPerPage, setProductsPerPage] = useState(10)
|
|
43
|
+
const [currentPage, setCurrentPage] = useState(defaultPage || 1)
|
|
44
|
+
const [productsPerPage, setProductsPerPage] = useState(defaultPageSize || 10)
|
|
41
45
|
const [currentProducts, setCurrentProducts] = useState([])
|
|
42
46
|
const [totalPages, setTotalPages] = useState(null)
|
|
43
47
|
|
|
@@ -70,21 +74,21 @@ export const ReviewProductsListingUI = (props) => {
|
|
|
70
74
|
setCurCategoryId(product?.category?.id)
|
|
71
75
|
setOpenReview(true)
|
|
72
76
|
if (!isInitialRender) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
addQueryToUrl({
|
|
78
|
+
category: product?.category?.id,
|
|
79
|
+
product: product.id
|
|
80
|
+
})
|
|
76
81
|
}
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
const handleCloseReviewDetails = () => {
|
|
80
85
|
setCurProduct(null)
|
|
81
86
|
setOpenReview(false)
|
|
82
|
-
|
|
83
|
-
const business = query.get('business')
|
|
84
|
-
history.replace(`${location.pathname}?tab=${tab}&business=${business}`)
|
|
87
|
+
removeQueryToUrl(['category', 'product'])
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
useEffect(() => {
|
|
91
|
+
if (firstRender) return
|
|
88
92
|
setCurrentPage(1)
|
|
89
93
|
}, [searchValue])
|
|
90
94
|
|
|
@@ -102,6 +106,14 @@ export const ReviewProductsListingUI = (props) => {
|
|
|
102
106
|
}
|
|
103
107
|
}, [])
|
|
104
108
|
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (!isUseQuery || !currentPage || !productsPerPage || !totalPages) return
|
|
111
|
+
addQueryToUrl({
|
|
112
|
+
page: currentPage,
|
|
113
|
+
pageSize: productsPerPage
|
|
114
|
+
})
|
|
115
|
+
}, [currentPage, productsPerPage, totalPages])
|
|
116
|
+
|
|
105
117
|
return (
|
|
106
118
|
<>
|
|
107
119
|
<ReviewsListingContainer>
|