ordering-ui-admin-external 1.14.3 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_bundles/{ordering-ui-admin.e2a58dcc95d6a983dfc0.js → ordering-ui-admin.7c0f4e22698e5dbd9b25.js} +2 -2
- package/_modules/components/BusinessIntelligence/BusinessReviewDetails/index.js +5 -5
- package/_modules/components/BusinessIntelligence/BusinessReviewList/index.js +29 -4
- package/_modules/components/BusinessIntelligence/InvoiceBusinessManager/index.js +16 -1
- package/_modules/components/BusinessIntelligence/InvoiceDriverManager/index.js +16 -1
- package/_modules/components/BusinessIntelligence/InvoiceManager/index.js +14 -1
- package/_modules/components/BusinessIntelligence/InvoiceOrdertype/styles.js +1 -1
- package/_modules/components/BusinessIntelligence/ProductReviewDetails/index.js +4 -3
- package/_modules/components/BusinessIntelligence/Reports/index.js +14 -1
- package/_modules/components/BusinessIntelligence/ReviewProductsListing/index.js +52 -16
- package/_modules/components/BusinessIntelligence/ReviewsListing/index.js +32 -4
- package/_modules/components/BusinessIntelligence/UserReviewDetails/index.js +4 -3
- package/_modules/components/BusinessIntelligence/UsersReviewList/index.js +35 -10
- package/_modules/components/CartRecovery/RecoveryActionDetail/index.js +21 -2
- package/_modules/components/CartRecovery/RecoveryActionListing/index.js +22 -2
- package/_modules/components/Delivery/DeliveryUsersListing/index.js +2 -0
- package/_modules/components/Delivery/DriversCompaniesListing/index.js +36 -13
- package/_modules/components/Delivery/DriversCompanyDetailsForm/index.js +31 -6
- package/_modules/components/Delivery/DriversGroupDetails/index.js +29 -2
- package/_modules/components/Delivery/DriversGroupLogistics/index.js +16 -2
- package/_modules/components/Delivery/DriversGroupsListing/index.js +28 -11
- package/_modules/components/Delivery/UserDetails/index.js +24 -1
- package/_modules/components/Loyalty/GiftCardDetail/styles.js +68 -0
- package/_modules/components/Loyalty/GiftCards/index.js +23 -2
- package/_modules/components/Loyalty/PointsWalletBusinessList/index.js +26 -1
- package/_modules/components/Loyalty/PointsWalletLevels/index.js +22 -1
- package/_modules/components/Loyalty/RewardsPrograms/index.js +34 -4
- package/_modules/components/Loyalty/Wallet/index.js +20 -1
- package/_modules/components/Marketing/AdBannersListing/index.js +24 -5
- package/_modules/components/Marketing/BannerImageDetails/index.js +2 -1
- package/_modules/components/Marketing/CampaignDetail/index.js +19 -1
- package/_modules/components/Marketing/CampaignEmail/styles.js +5 -3
- package/_modules/components/Marketing/CampaignListing/index.js +19 -0
- package/_modules/components/Marketing/CampaignNotification/styles.js +5 -3
- package/_modules/components/Marketing/CampaignSMS/styles.js +5 -3
- package/_modules/components/Marketing/EnterprisePromotionGeneralDetails/index.js +2 -1
- package/_modules/components/Marketing/EnterprisePromotionListing/index.js +24 -4
- package/_modules/components/Marketing/PageBanner/index.js +27 -3
- package/_modules/components/Messages/MessagesListing/index.js +18 -1
- package/_modules/components/MyProducts/AdvancedSettings/FontStyleGroup.js +85 -0
- package/_modules/components/MyProducts/AdvancedSettings/OrderType.js +45 -0
- package/_modules/components/MyProducts/AdvancedSettings/SettingComponent.js +91 -0
- package/_modules/components/MyProducts/AdvancedSettings/index.js +626 -0
- package/_modules/components/MyProducts/AdvancedSettings/styles.js +146 -0
- package/_modules/components/MyProducts/AppLayout/index.js +9 -1
- package/_modules/components/MyProducts/AppLayout/styles.js +20 -3
- package/_modules/components/MyProducts/CallCenterApp/index.js +1 -1
- package/_modules/components/MyProducts/CustomerApp/index.js +2 -2
- package/_modules/components/MyProducts/DriverApp/index.js +2 -2
- package/_modules/components/MyProducts/KioskApp/index.js +1 -1
- package/_modules/components/MyProducts/OrderingWebsite/index.js +37 -6
- package/_modules/components/MyProducts/OrderingWebsite/styles.js +39 -5
- package/_modules/components/MyProducts/PosApp/index.js +1 -1
- package/_modules/components/MyProducts/StoreApp/index.js +2 -2
- package/_modules/components/OrderingProducts/OrderingProductDetails/index.js +21 -1
- package/_modules/components/OrderingProducts/OrderingProductsListing/index.js +18 -1
- package/_modules/components/Orders/DeliveriesManager/index.js +0 -1
- package/_modules/components/Orders/Messages/index.js +32 -29
- package/_modules/components/Orders/OrderDetails/index.js +38 -22
- package/_modules/components/Orders/OrderDetailsHeader/index.js +2 -3
- package/_modules/components/Orders/OrdersContentHeader/index.js +2 -2
- package/_modules/components/Orders/OrdersFilterGroup/index.js +112 -9
- package/_modules/components/Orders/OrdersFilterGroup/styles.js +11 -3
- package/_modules/components/Orders/OrdersManager/index.js +0 -1
- package/_modules/components/Settings/CountriesList/index.js +27 -4
- package/_modules/components/Settings/Deliverect/index.js +23 -2
- package/_modules/components/Settings/DoordashConnect/index.js +23 -2
- package/_modules/components/Settings/DropdownOptionList/index.js +27 -4
- package/_modules/components/Settings/IntegrationListing/index.js +3 -3
- package/_modules/components/Settings/ItsaCheckmate/index.js +23 -2
- package/_modules/components/Settings/LalamoveConnect/index.js +23 -2
- package/_modules/components/Settings/PickerExpress/index.js +23 -2
- package/_modules/components/Settings/PlaceListing/index.js +40 -4
- package/_modules/components/Settings/Settings/index.js +86 -45
- package/_modules/components/Settings/SettingsDetail/index.js +14 -1
- package/_modules/components/Settings/SitesAuthSettings/index.js +17 -1
- package/_modules/components/SidebarMenu/index.js +0 -1
- package/_modules/components/Stores/BusinessAdd/BusinessDetails/index.js +4 -9
- package/_modules/components/Stores/BusinessAdd/BusinessDetails/styles.js +3 -1
- package/_modules/components/Stores/BusinessAdd/DeliveryZone/index.js +13 -4
- package/_modules/components/Stores/BusinessAdd/DeliveryZone/styles.js +16 -10
- package/_modules/components/Stores/BusinessAdd/PaymentMethods/index.js +11 -3
- package/_modules/components/Stores/BusinessAdd/PaymentMethods/styles.js +3 -1
- package/_modules/components/Stores/BusinessAdd/ReceiveOrders/index.js +17 -6
- package/_modules/components/Stores/BusinessAdd/ReceiveOrders/styles.js +3 -1
- package/_modules/components/Stores/BusinessAdd/index.js +38 -8
- package/_modules/components/Stores/BusinessAdd/styles.js +8 -4
- package/_modules/components/Stores/BusinessAddStore/index.js +1 -1
- package/_modules/components/Stores/BusinessBrandListing/index.js +37 -4
- package/_modules/components/Stores/BusinessDeliveryPickupMore/index.js +20 -1
- package/_modules/components/Stores/BusinessDeliveryZoneDetails/index.js +22 -1
- package/_modules/components/Stores/BusinessDeliveryZoneList/index.js +32 -4
- package/_modules/components/Stores/BusinessDetail/index.js +18 -1
- package/_modules/components/Stores/BusinessDetails/index.js +17 -1
- package/_modules/components/Stores/BusinessFrontLayout/index.js +8 -1
- package/_modules/components/Stores/BusinessFrontLayout/styles.js +5 -3
- package/_modules/components/Stores/BusinessMenu/index.js +58 -7
- package/_modules/components/Stores/BusinessMenuOptions/index.js +24 -3
- package/_modules/components/Stores/BusinessOrderingChannels/index.js +18 -2
- package/_modules/components/Stores/BusinessPaymentMethods/index.js +26 -2
- package/_modules/components/Stores/BusinessPlaceGroupList/index.js +183 -0
- package/_modules/components/Stores/BusinessPlaceGroupList/styles.js +66 -0
- package/_modules/components/Stores/BusinessProductsCategoyDetails/index.js +21 -1
- package/_modules/components/Stores/BusinessProductsListing/index.js +74 -22
- package/_modules/components/Stores/BusinessPromotionGeneralForm/index.js +2 -2
- package/_modules/components/Stores/BusinessSharedMenuProducts/index.js +29 -2
- package/_modules/components/Stores/BusinessSync/index.js +16 -1
- package/_modules/components/Stores/BusinessTypes/index.js +27 -4
- package/_modules/components/Stores/BusinessWalletsList/index.js +24 -1
- package/_modules/components/Stores/BusinessesListing/index.js +9 -1
- package/_modules/components/Stores/ImportersButton/index.js +19 -6
- package/_modules/components/Stores/PaymentOption/index.js +29 -9
- package/_modules/components/Stores/PaymentOptionMethods/index.js +23 -3
- package/_modules/components/Stores/PaymentOptionPaypal/index.js +23 -3
- package/_modules/components/Stores/PaymentOptionSquare/index.js +23 -3
- package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +23 -3
- package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +23 -3
- package/_modules/components/Stores/PaymethodOptionStripeConnect/index.js +23 -3
- package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +23 -3
- package/_modules/components/Stores/ProductDetails/index.js +18 -1
- package/_modules/components/Stores/ProductExtras/index.js +25 -2
- package/_modules/components/Stores/ProductIngredient/index.js +23 -1
- package/_modules/components/Stores/ProductMainDetails/index.js +18 -1
- package/_modules/components/Stores/ProductTagsList/index.js +28 -2
- package/_modules/components/Users/CustomerCashWallet/index.js +22 -2
- package/_modules/components/Users/CustomerDetails/index.js +19 -1
- package/_modules/components/Users/CustomerPointsWallet/index.js +22 -2
- package/_modules/components/Users/CustomersListing/index.js +8 -3
- package/_modules/components/Users/ProfessionalDetail/index.js +25 -1
- package/_modules/components/Users/ProfessionalListing/index.js +8 -3
- package/_modules/components/Users/UserActiveStateFilter/index.js +18 -4
- package/_modules/components/Users/UserDetails/index.js +27 -1
- package/_modules/components/Users/UsersListing/index.js +8 -3
- package/package.json +2 -2
- package/src/components/BusinessIntelligence/BusinessReviewDetails/index.js +4 -4
- package/src/components/BusinessIntelligence/BusinessReviewList/index.js +29 -6
- package/src/components/BusinessIntelligence/InvoiceBusinessManager/index.js +17 -1
- package/src/components/BusinessIntelligence/InvoiceDriverManager/index.js +17 -1
- package/src/components/BusinessIntelligence/InvoiceManager/index.js +16 -2
- package/src/components/BusinessIntelligence/InvoiceOrdertype/styles.js +1 -0
- package/src/components/BusinessIntelligence/ProductReviewDetails/index.js +4 -4
- package/src/components/BusinessIntelligence/Reports/index.js +16 -2
- package/src/components/BusinessIntelligence/ReviewProductsListing/index.js +34 -6
- package/src/components/BusinessIntelligence/ReviewsListing/index.js +31 -5
- package/src/components/BusinessIntelligence/UserReviewDetails/index.js +4 -4
- package/src/components/BusinessIntelligence/UsersReviewList/index.js +32 -11
- package/src/components/CartRecovery/RecoveryActionDetail/index.js +19 -1
- package/src/components/CartRecovery/RecoveryActionListing/index.js +21 -3
- package/src/components/Delivery/DeliveryUsersListing/index.js +3 -1
- package/src/components/Delivery/DriversCompaniesListing/index.js +27 -9
- package/src/components/Delivery/DriversCompanyDetailsForm/index.js +37 -8
- package/src/components/Delivery/DriversGroupDetails/index.js +36 -4
- package/src/components/Delivery/DriversGroupLogistics/index.js +18 -2
- package/src/components/Delivery/DriversGroupsListing/index.js +20 -6
- package/src/components/Delivery/UserDetails/index.js +26 -1
- package/src/components/Loyalty/GiftCardDetail/styles.js +192 -0
- package/src/components/Loyalty/GiftCards/index.js +22 -2
- package/src/components/Loyalty/PointsWalletBusinessList/index.js +24 -1
- package/src/components/Loyalty/PointsWalletLevels/index.js +21 -1
- package/src/components/Loyalty/RewardsPrograms/index.js +30 -3
- package/src/components/Loyalty/Wallet/index.js +22 -1
- package/src/components/Marketing/AdBannersListing/index.js +25 -8
- package/src/components/Marketing/BannerImageDetails/index.js +2 -1
- package/src/components/Marketing/CampaignDetail/index.js +22 -1
- package/src/components/Marketing/CampaignEmail/styles.js +3 -0
- package/src/components/Marketing/CampaignListing/index.js +18 -1
- package/src/components/Marketing/CampaignNotification/styles.js +3 -0
- package/src/components/Marketing/CampaignSMS/styles.js +3 -0
- package/src/components/Marketing/EnterprisePromotionGeneralDetails/index.js +2 -1
- package/src/components/Marketing/EnterprisePromotionListing/index.js +19 -1
- package/src/components/Marketing/PageBanner/index.js +26 -3
- package/src/components/Messages/MessagesListing/index.js +17 -0
- package/src/components/MyProducts/AdvancedSettings/FontStyleGroup.js +64 -0
- package/src/components/MyProducts/AdvancedSettings/OrderType.js +40 -0
- package/src/components/MyProducts/AdvancedSettings/SettingComponent.js +104 -0
- package/src/components/MyProducts/AdvancedSettings/index.js +541 -0
- package/src/components/MyProducts/AdvancedSettings/styles.js +388 -0
- package/src/components/MyProducts/AppLayout/index.js +19 -2
- package/src/components/MyProducts/AppLayout/styles.js +65 -0
- package/src/components/MyProducts/CallCenterApp/index.js +1 -1
- package/src/components/MyProducts/CustomerApp/index.js +2 -2
- package/src/components/MyProducts/DriverApp/index.js +2 -2
- package/src/components/MyProducts/KioskApp/index.js +1 -1
- package/src/components/MyProducts/OrderingWebsite/index.js +309 -255
- package/src/components/MyProducts/OrderingWebsite/styles.js +99 -2
- package/src/components/MyProducts/PosApp/index.js +1 -1
- package/src/components/MyProducts/StoreApp/index.js +2 -2
- package/src/components/OrderingProducts/OrderingProductDetails/index.js +24 -2
- package/src/components/OrderingProducts/OrderingProductsListing/index.js +17 -1
- package/src/components/Orders/DeliveriesManager/index.js +0 -1
- package/src/components/Orders/Messages/index.js +31 -11
- package/src/components/Orders/OrderDetails/index.js +34 -20
- package/src/components/Orders/OrderDetailsHeader/index.js +2 -3
- package/src/components/Orders/OrdersContentHeader/index.js +1 -1
- package/src/components/Orders/OrdersFilterGroup/index.js +111 -13
- package/src/components/Orders/OrdersFilterGroup/styles.js +26 -0
- package/src/components/Orders/OrdersManager/index.js +0 -1
- package/src/components/Settings/CountriesList/index.js +26 -6
- package/src/components/Settings/Deliverect/index.js +26 -2
- package/src/components/Settings/DoordashConnect/index.js +26 -2
- package/src/components/Settings/DropdownOptionList/index.js +27 -6
- package/src/components/Settings/IntegrationListing/index.js +3 -3
- package/src/components/Settings/ItsaCheckmate/index.js +26 -2
- package/src/components/Settings/LalamoveConnect/index.js +26 -2
- package/src/components/Settings/PickerExpress/index.js +26 -2
- package/src/components/Settings/PlaceListing/index.js +38 -6
- package/src/components/Settings/Settings/index.js +79 -37
- package/src/components/Settings/SettingsDetail/index.js +15 -1
- package/src/components/Settings/SitesAuthSettings/index.js +18 -1
- package/src/components/SidebarMenu/index.js +0 -2
- package/src/components/Stores/BusinessAdd/BusinessDetails/index.js +1 -10
- package/src/components/Stores/BusinessAdd/BusinessDetails/styles.js +4 -0
- package/src/components/Stores/BusinessAdd/DeliveryZone/index.js +120 -109
- package/src/components/Stores/BusinessAdd/DeliveryZone/styles.js +22 -1
- package/src/components/Stores/BusinessAdd/PaymentMethods/index.js +8 -2
- package/src/components/Stores/BusinessAdd/PaymentMethods/styles.js +4 -0
- package/src/components/Stores/BusinessAdd/ReceiveOrders/index.js +11 -6
- package/src/components/Stores/BusinessAdd/ReceiveOrders/styles.js +4 -0
- package/src/components/Stores/BusinessAdd/index.js +47 -16
- package/src/components/Stores/BusinessAdd/styles.js +27 -1
- package/src/components/Stores/BusinessAddStore/index.js +1 -1
- package/src/components/Stores/BusinessBrandListing/index.js +37 -4
- package/src/components/Stores/BusinessDeliveryPickupMore/index.js +22 -1
- package/src/components/Stores/BusinessDeliveryZoneDetails/index.js +25 -2
- package/src/components/Stores/BusinessDeliveryZoneList/index.js +30 -3
- package/src/components/Stores/BusinessDetail/index.js +20 -1
- package/src/components/Stores/BusinessDetails/index.js +18 -1
- package/src/components/Stores/BusinessFrontLayout/index.js +13 -1
- package/src/components/Stores/BusinessFrontLayout/styles.js +11 -0
- package/src/components/Stores/BusinessMenu/index.js +56 -11
- package/src/components/Stores/BusinessMenuOptions/index.js +28 -3
- package/src/components/Stores/BusinessOrderingChannels/index.js +19 -2
- package/src/components/Stores/BusinessPaymentMethods/index.js +24 -2
- package/src/components/Stores/BusinessPlaceGroupList/index.js +193 -0
- package/src/components/Stores/BusinessPlaceGroupList/styles.js +143 -0
- package/src/components/Stores/BusinessProductsCategoyDetails/index.js +21 -1
- package/src/components/Stores/BusinessProductsListing/index.js +49 -8
- package/src/components/Stores/BusinessPromotionGeneralForm/index.js +2 -2
- package/src/components/Stores/BusinessSharedMenuProducts/index.js +29 -3
- package/src/components/Stores/BusinessSync/index.js +18 -2
- package/src/components/Stores/BusinessTypes/index.js +26 -4
- package/src/components/Stores/BusinessWalletsList/index.js +23 -1
- package/src/components/Stores/BusinessesListing/index.js +11 -2
- package/src/components/Stores/ImportersButton/index.js +24 -3
- package/src/components/Stores/PaymentOption/index.js +29 -8
- package/src/components/Stores/PaymentOptionMethods/index.js +25 -3
- package/src/components/Stores/PaymentOptionPaypal/index.js +25 -3
- package/src/components/Stores/PaymentOptionSquare/index.js +25 -3
- package/src/components/Stores/PaymentOptionStripeDirect/index.js +25 -3
- package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +25 -3
- package/src/components/Stores/PaymethodOptionStripeConnect/index.js +25 -3
- package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +25 -3
- package/src/components/Stores/ProductDetails/index.js +19 -1
- package/src/components/Stores/ProductExtras/index.js +23 -2
- package/src/components/Stores/ProductIngredient/index.js +23 -2
- package/src/components/Stores/ProductMainDetails/index.js +20 -2
- package/src/components/Stores/ProductTagsList/index.js +28 -3
- package/src/components/Users/CustomerCashWallet/index.js +25 -3
- package/src/components/Users/CustomerDetails/index.js +20 -1
- package/src/components/Users/CustomerPointsWallet/index.js +25 -3
- package/src/components/Users/CustomersListing/index.js +9 -4
- package/src/components/Users/ProfessionalDetail/index.js +27 -1
- package/src/components/Users/ProfessionalListing/index.js +9 -4
- package/src/components/Users/UserActiveStateFilter/index.js +16 -3
- package/src/components/Users/UserDetails/index.js +27 -1
- package/src/components/Users/UsersListing/index.js +9 -4
- package/template/pages/BusinessProductsList/index.js +1 -1
- /package/_bundles/{ordering-ui-admin.e2a58dcc95d6a983dfc0.js.LICENSE.txt → ordering-ui-admin.7c0f4e22698e5dbd9b25.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { useHistory, useLocation } from 'react-router-dom'
|
|
3
|
+
import { useLanguage, BusinessPlaceGroupList as BusinessPlaceGroupListController } from 'ordering-components-admin-external'
|
|
4
|
+
import Skeleton from 'react-loading-skeleton'
|
|
5
|
+
import { Button } from '../../../styles'
|
|
6
|
+
import { ChevronRight, CheckSquareFill, Square } from 'react-bootstrap-icons'
|
|
7
|
+
import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
8
|
+
import { BusinessPlaceGroup } from '../BusinessPlaceGroup'
|
|
9
|
+
import { Modal } from '../../Shared'
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
Container,
|
|
13
|
+
Header,
|
|
14
|
+
Content,
|
|
15
|
+
AddBtn,
|
|
16
|
+
TableHead,
|
|
17
|
+
CheckWrapper,
|
|
18
|
+
PlaceItemContainer,
|
|
19
|
+
PlaceContainer
|
|
20
|
+
} from './styles'
|
|
21
|
+
|
|
22
|
+
export const BusinessPlaceGroupListUI = (props) => {
|
|
23
|
+
const {
|
|
24
|
+
placeGroupList,
|
|
25
|
+
setIsExtendExtraOpen,
|
|
26
|
+
business,
|
|
27
|
+
handleSuccessAddPlaceGroup,
|
|
28
|
+
handleSuccessUpdatePlaceGroup,
|
|
29
|
+
handleSuccessDeletePlaceGroup,
|
|
30
|
+
handleChangeEnabled,
|
|
31
|
+
handleMultiChangeEnabled,
|
|
32
|
+
getMultiCheckStatus
|
|
33
|
+
} = props
|
|
34
|
+
|
|
35
|
+
const history = useHistory()
|
|
36
|
+
const query = new URLSearchParams(useLocation().search)
|
|
37
|
+
const [, t] = useLanguage()
|
|
38
|
+
const { width } = useWindowSize()
|
|
39
|
+
const [openDetail, setOpenDetail] = useState(false)
|
|
40
|
+
const [selectedPlace, setSelectedPlace] = useState(null)
|
|
41
|
+
|
|
42
|
+
const handleOpenDetail = (placeGroup) => {
|
|
43
|
+
setOpenDetail(true)
|
|
44
|
+
setSelectedPlace(placeGroup)
|
|
45
|
+
setIsExtendExtraOpen(true)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const handleCloseDetail = () => {
|
|
49
|
+
setOpenDetail(false)
|
|
50
|
+
setSelectedPlace(null)
|
|
51
|
+
setIsExtendExtraOpen(false)
|
|
52
|
+
const businessId = query.get('id')
|
|
53
|
+
const section = query.get('section')
|
|
54
|
+
history.replace(`${location.pathname}?id=${businessId}§ion=${section}`)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const handleUpdateSelectedPlaceGroup = (placeGroup) => {
|
|
58
|
+
setSelectedPlace(placeGroup)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handlePlaceClick = (e, placeGroup, isInitialRender) => {
|
|
62
|
+
if (e?.target?.closest('.check-box')) return
|
|
63
|
+
handleOpenDetail(placeGroup)
|
|
64
|
+
if (!isInitialRender) {
|
|
65
|
+
const businessId = query.get('id')
|
|
66
|
+
const section = query.get('section')
|
|
67
|
+
history.replace(`${location.pathname}?id=${businessId}§ion=${section}&place_group=${placeGroup.id}`)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const handleCheckBoxChange = (placeGroup) => {
|
|
72
|
+
handleChangeEnabled(placeGroup?.id, { enabled: !placeGroup?.enabled })
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (placeGroupList?.loading) return
|
|
77
|
+
const placeGroupId = query.get('place_group')
|
|
78
|
+
if (placeGroupId) {
|
|
79
|
+
const initPlaceGroup = placeGroupList?.placeGroups?.find(placeGroup => placeGroup.id === Number(placeGroupId))
|
|
80
|
+
if (initPlaceGroup) {
|
|
81
|
+
handlePlaceClick(null, initPlaceGroup, true)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, [placeGroupList?.loading])
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Container>
|
|
88
|
+
<PlaceContainer>
|
|
89
|
+
<Header>
|
|
90
|
+
<h1>{t('PLACES', 'Places')}</h1>
|
|
91
|
+
<Button
|
|
92
|
+
color='lightPrimary'
|
|
93
|
+
borderRadius='8px'
|
|
94
|
+
onClick={() => handleOpenDetail(null)}
|
|
95
|
+
>
|
|
96
|
+
{t('ADD_PLACES', 'Add places')}
|
|
97
|
+
</Button>
|
|
98
|
+
</Header>
|
|
99
|
+
{placeGroupList?.loading ? (
|
|
100
|
+
<Content>
|
|
101
|
+
{
|
|
102
|
+
[...Array(5).keys()].map(i => (
|
|
103
|
+
<PlaceItemContainer key={i}>
|
|
104
|
+
<CheckWrapper>
|
|
105
|
+
<Skeleton width={16} height={16} />
|
|
106
|
+
<label>
|
|
107
|
+
<Skeleton width={100} />
|
|
108
|
+
</label>
|
|
109
|
+
</CheckWrapper>
|
|
110
|
+
<Skeleton width={16} height={16} />
|
|
111
|
+
</PlaceItemContainer>
|
|
112
|
+
))
|
|
113
|
+
}
|
|
114
|
+
</Content>
|
|
115
|
+
) : (
|
|
116
|
+
<Content>
|
|
117
|
+
{placeGroupList?.placeGroups?.length > 0 && (
|
|
118
|
+
<TableHead>
|
|
119
|
+
<CheckWrapper>
|
|
120
|
+
<span className='check-box' onClick={() => handleMultiChangeEnabled()}>
|
|
121
|
+
{getMultiCheckStatus() ? <CheckSquareFill className='active' /> : <Square />}
|
|
122
|
+
</span>
|
|
123
|
+
<label>{t('PLACES', 'Places')}</label>
|
|
124
|
+
</CheckWrapper>
|
|
125
|
+
</TableHead>
|
|
126
|
+
)}
|
|
127
|
+
{placeGroupList?.placeGroups?.map((placeGroup, i) => (
|
|
128
|
+
<PlaceItemContainer
|
|
129
|
+
key={i}
|
|
130
|
+
active={selectedPlace?.id === placeGroup?.id}
|
|
131
|
+
onClick={(e) => handlePlaceClick(e, placeGroup)}
|
|
132
|
+
>
|
|
133
|
+
<CheckWrapper>
|
|
134
|
+
<span className='check-box' onClick={() => handleCheckBoxChange(placeGroup)}>
|
|
135
|
+
{placeGroup?.enabled ? <CheckSquareFill className='active' /> : <Square />}
|
|
136
|
+
</span>
|
|
137
|
+
<label>{placeGroup?.name}</label>
|
|
138
|
+
</CheckWrapper>
|
|
139
|
+
<ChevronRight />
|
|
140
|
+
</PlaceItemContainer>
|
|
141
|
+
))}
|
|
142
|
+
<AddBtn onClick={() => handleOpenDetail(null)}>{t('ADD_PLACES', 'Add places')}</AddBtn>
|
|
143
|
+
</Content>
|
|
144
|
+
)}
|
|
145
|
+
</PlaceContainer>
|
|
146
|
+
{width >= 1000 ? (
|
|
147
|
+
<>
|
|
148
|
+
{openDetail && (
|
|
149
|
+
<BusinessPlaceGroup
|
|
150
|
+
businessId={business?.id}
|
|
151
|
+
open={openDetail}
|
|
152
|
+
onClose={handleCloseDetail}
|
|
153
|
+
placeGroup={selectedPlace}
|
|
154
|
+
handleSuccessAddPlaceGroup={handleSuccessAddPlaceGroup}
|
|
155
|
+
handleSuccessUpdatePlaceGroup={handleSuccessUpdatePlaceGroup}
|
|
156
|
+
handleSuccessDeletePlaceGroup={handleSuccessDeletePlaceGroup}
|
|
157
|
+
handleUpdateSelectedPlaceGroup={handleUpdateSelectedPlaceGroup}
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
160
|
+
</>
|
|
161
|
+
) : (
|
|
162
|
+
<>
|
|
163
|
+
{openDetail && (
|
|
164
|
+
<Modal
|
|
165
|
+
width='760px'
|
|
166
|
+
open={openDetail}
|
|
167
|
+
onClose={() => handleCloseDetail()}
|
|
168
|
+
>
|
|
169
|
+
<BusinessPlaceGroup
|
|
170
|
+
businessId={business?.id}
|
|
171
|
+
open={openDetail}
|
|
172
|
+
onClose={handleCloseDetail}
|
|
173
|
+
placeGroup={selectedPlace}
|
|
174
|
+
handleSuccessAddPlaceGroup={handleSuccessAddPlaceGroup}
|
|
175
|
+
handleSuccessUpdatePlaceGroup={handleSuccessUpdatePlaceGroup}
|
|
176
|
+
handleSuccessDeletePlaceGroup={handleSuccessDeletePlaceGroup}
|
|
177
|
+
handleUpdateSelectedPlaceGroup={handleUpdateSelectedPlaceGroup}
|
|
178
|
+
/>
|
|
179
|
+
</Modal>
|
|
180
|
+
)}
|
|
181
|
+
</>
|
|
182
|
+
)}
|
|
183
|
+
</Container>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export const BusinessPlaceGroupList = (props) => {
|
|
188
|
+
const businessPlaceListProps = {
|
|
189
|
+
...props,
|
|
190
|
+
UIComponent: BusinessPlaceGroupListUI
|
|
191
|
+
}
|
|
192
|
+
return <BusinessPlaceGroupListController {...businessPlaceListProps} />
|
|
193
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const Container = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
height: 100%;
|
|
6
|
+
`
|
|
7
|
+
|
|
8
|
+
export const PlaceContainer = styled.div`
|
|
9
|
+
${({ isHide }) => isHide ? css`
|
|
10
|
+
width: 0px;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
flex: initial;
|
|
13
|
+
` : css`
|
|
14
|
+
flex: 1;
|
|
15
|
+
`}
|
|
16
|
+
transition: 0.3s;
|
|
17
|
+
@media (min-width: 576px) {
|
|
18
|
+
${({ isHide }) => isHide ? css`
|
|
19
|
+
padding: 0;
|
|
20
|
+
` : css`
|
|
21
|
+
padding: 20px;
|
|
22
|
+
`}
|
|
23
|
+
}
|
|
24
|
+
`
|
|
25
|
+
|
|
26
|
+
export const Header = styled.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
|
|
32
|
+
h1 {
|
|
33
|
+
font-size: 20px;
|
|
34
|
+
font-weight: 700;
|
|
35
|
+
margin-top: 0px;
|
|
36
|
+
margin-bottom: 18px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
button {
|
|
40
|
+
margin-bottom: 18px;
|
|
41
|
+
height: 44px;
|
|
42
|
+
margin-right: 40px;
|
|
43
|
+
|
|
44
|
+
${props => props.theme.rtl && css`
|
|
45
|
+
margin-left: 40px;
|
|
46
|
+
margin-right: 0px;
|
|
47
|
+
`}
|
|
48
|
+
}
|
|
49
|
+
`
|
|
50
|
+
|
|
51
|
+
export const Content = styled.div``
|
|
52
|
+
|
|
53
|
+
export const AddBtn = styled.span`
|
|
54
|
+
font-weight: 400;
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
display: block;
|
|
57
|
+
margin: 10px 0px;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
user-select: none;
|
|
60
|
+
color: ${props => props.theme.colors.lightGray};
|
|
61
|
+
transition: color 0.2s ease;
|
|
62
|
+
|
|
63
|
+
&:hover {
|
|
64
|
+
color: ${props => props.theme.colors.primary};
|
|
65
|
+
}
|
|
66
|
+
`
|
|
67
|
+
|
|
68
|
+
export const TableHead = styled.div`
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
padding-bottom: 8px;
|
|
72
|
+
border-bottom: 1px solid ${props => props.theme.colors.secundaryLight};
|
|
73
|
+
|
|
74
|
+
label {
|
|
75
|
+
font-weight: 700;
|
|
76
|
+
}
|
|
77
|
+
`
|
|
78
|
+
|
|
79
|
+
export const CheckWrapper = styled.div`
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
|
|
83
|
+
.check-box {
|
|
84
|
+
cursor: pointer !important;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
span {
|
|
88
|
+
svg {
|
|
89
|
+
cursor: pointer !important;
|
|
90
|
+
font-size: 16px;
|
|
91
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
92
|
+
|
|
93
|
+
&.active {
|
|
94
|
+
color: ${props => props.theme.colors.primary};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
> label {
|
|
100
|
+
margin-bottom: 0;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
font-size: 14px;
|
|
104
|
+
margin-left: 20px;
|
|
105
|
+
${props => props.theme.rtl && css`
|
|
106
|
+
margin-right: 20px;
|
|
107
|
+
margin-left: 0px;
|
|
108
|
+
`}
|
|
109
|
+
}
|
|
110
|
+
`
|
|
111
|
+
|
|
112
|
+
export const PlaceItemContainer = styled.div`
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
padding: 12px 0;
|
|
116
|
+
border-bottom: 1px solid ${props => props.theme.colors.borderColor};
|
|
117
|
+
border-top: 1px solid transparent;
|
|
118
|
+
justify-content: space-between;
|
|
119
|
+
transition: all 0.3s linear;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
|
|
122
|
+
&:hover {
|
|
123
|
+
background: ${props => props.theme.colors.secundary};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
${({ active }) => active && css`
|
|
127
|
+
background: ${props => props.theme.colors.backgroundInfo};
|
|
128
|
+
border-top: 1px solid ${props => props.theme.colors.primary};
|
|
129
|
+
border-bottom: 1px solid ${props => props.theme.colors.primary};
|
|
130
|
+
`}
|
|
131
|
+
|
|
132
|
+
${({ notAllow }) => notAllow && css`
|
|
133
|
+
cursor: not-allowed;
|
|
134
|
+
* {
|
|
135
|
+
cursor: not-allowed;
|
|
136
|
+
}
|
|
137
|
+
`}
|
|
138
|
+
|
|
139
|
+
> svg {
|
|
140
|
+
font-size: 16px;
|
|
141
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
142
|
+
}
|
|
143
|
+
`
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useHistory, useLocation } from 'react-router-dom'
|
|
2
3
|
import Skeleton from 'react-loading-skeleton'
|
|
3
4
|
import { useLanguage, BusinessProductsCategoyDetails as BusinessProductsCategoyDetailsController } from 'ordering-components-admin-external'
|
|
4
5
|
import { ArrowsAngleContract, ArrowsAngleExpand, ThreeDots } from 'react-bootstrap-icons'
|
|
@@ -43,6 +44,8 @@ const BusinessProductsCategoyDetailsUI = (props) => {
|
|
|
43
44
|
handleTutorialSkip
|
|
44
45
|
} = props
|
|
45
46
|
|
|
47
|
+
const history = useHistory()
|
|
48
|
+
const query = new URLSearchParams(useLocation().search)
|
|
46
49
|
const theme = useTheme()
|
|
47
50
|
const [, t] = useLanguage()
|
|
48
51
|
const { width } = useWindowSize()
|
|
@@ -88,6 +91,23 @@ const BusinessProductsCategoyDetailsUI = (props) => {
|
|
|
88
91
|
}
|
|
89
92
|
}, [formState?.result])
|
|
90
93
|
|
|
94
|
+
const handleTabClick = (tab, isInitialRender) => {
|
|
95
|
+
setSelctedInfoItem(tab)
|
|
96
|
+
if (!isInitialRender) {
|
|
97
|
+
const category = query.get('category')
|
|
98
|
+
history.replace(`${location.pathname}?category=${category}&tab=${tab}`)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
const tab = query.get('tab')
|
|
104
|
+
if (tab) {
|
|
105
|
+
handleTabClick(tab, true)
|
|
106
|
+
} else {
|
|
107
|
+
handleTabClick(selectedInfoItem)
|
|
108
|
+
}
|
|
109
|
+
}, [])
|
|
110
|
+
|
|
91
111
|
return (
|
|
92
112
|
<>
|
|
93
113
|
<Container>
|
|
@@ -163,7 +183,7 @@ const BusinessProductsCategoyDetailsUI = (props) => {
|
|
|
163
183
|
{!isAddMode && (
|
|
164
184
|
<BusinessCategoryInfoSettingList
|
|
165
185
|
selectedInfoItem={selectedInfoItem}
|
|
166
|
-
handleSelectInfoItem={
|
|
186
|
+
handleSelectInfoItem={tab => handleTabClick(tab)}
|
|
167
187
|
/>
|
|
168
188
|
)}
|
|
169
189
|
{selectedInfoItem === 'information' && (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react'
|
|
2
|
+
import { useHistory, useLocation } from 'react-router-dom'
|
|
2
3
|
import Skeleton from 'react-loading-skeleton'
|
|
3
4
|
import BisDownArrow from '@meronex/icons/bi/BisDownArrow'
|
|
4
5
|
import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
@@ -26,6 +27,7 @@ import { OverlayTrigger, Tooltip } from 'react-bootstrap'
|
|
|
26
27
|
import { ImportersButton } from '../ImportersButton'
|
|
27
28
|
import { AddBusinessForm } from '../AddBusinessForm'
|
|
28
29
|
import { ProductStep } from '../ProductStep'
|
|
30
|
+
import { BusinessAddStore } from '../BusinessAddStore'
|
|
29
31
|
|
|
30
32
|
import {
|
|
31
33
|
CategoryProductsContainer,
|
|
@@ -75,6 +77,8 @@ const BusinessProductsListingUI = (props) => {
|
|
|
75
77
|
setBusinessTypes
|
|
76
78
|
} = props
|
|
77
79
|
|
|
80
|
+
const history = useHistory()
|
|
81
|
+
const query = new URLSearchParams(useLocation().search)
|
|
78
82
|
const [, t] = useLanguage()
|
|
79
83
|
const { width } = useWindowSize()
|
|
80
84
|
const [ordering] = useApi()
|
|
@@ -89,6 +93,7 @@ const BusinessProductsListingUI = (props) => {
|
|
|
89
93
|
const [batchImageFormOpen, setBatchImageFormOpen] = useState(false)
|
|
90
94
|
const [openSidebar, setOpenSidebar] = useState(null)
|
|
91
95
|
const [showPopup, setShowPopup] = useState(false)
|
|
96
|
+
const [isAdd, setIsAdd] = useState(false)
|
|
92
97
|
|
|
93
98
|
const [allowSpreadColumns, setAllowSpreadColumns] = useState({
|
|
94
99
|
id: true,
|
|
@@ -112,13 +117,16 @@ const BusinessProductsListingUI = (props) => {
|
|
|
112
117
|
})
|
|
113
118
|
}
|
|
114
119
|
|
|
115
|
-
const handleOpenCategoryDetails = (category = null) => {
|
|
120
|
+
const handleOpenCategoryDetails = (category = null, isInitialRender) => {
|
|
116
121
|
setOpenSidebar(null)
|
|
117
122
|
setSelectedProduct(null)
|
|
118
123
|
setCurrentCategory(category)
|
|
119
124
|
if (category && category?.id !== null) {
|
|
120
125
|
setCategorySelected(category)
|
|
121
126
|
setOpenSidebar('category_details')
|
|
127
|
+
if (!isInitialRender) {
|
|
128
|
+
history.replace(`${location.pathname}?category=${category.id}`)
|
|
129
|
+
}
|
|
122
130
|
} else {
|
|
123
131
|
setCurrentCategory(null)
|
|
124
132
|
setOpenSidebar('category_details')
|
|
@@ -133,16 +141,19 @@ const BusinessProductsListingUI = (props) => {
|
|
|
133
141
|
})
|
|
134
142
|
setCurrentCategory(null)
|
|
135
143
|
setOpenSidebar(null)
|
|
144
|
+
history.replace(`${location.pathname}`)
|
|
136
145
|
}
|
|
137
146
|
|
|
138
|
-
const handleOpenProductDetails = (product) => {
|
|
147
|
+
const handleOpenProductDetails = (product, isInitialRender) => {
|
|
139
148
|
setSelectedProduct(product)
|
|
140
149
|
setOpenSidebar('product_details')
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
if (!isInitialRender) {
|
|
151
|
+
onProductRedirect({
|
|
152
|
+
slug: businessState?.business?.slug,
|
|
153
|
+
product: product.id,
|
|
154
|
+
category: product.category_id
|
|
155
|
+
})
|
|
156
|
+
}
|
|
146
157
|
}
|
|
147
158
|
|
|
148
159
|
const handleCloseProductDetails = () => {
|
|
@@ -203,7 +214,7 @@ const BusinessProductsListingUI = (props) => {
|
|
|
203
214
|
}
|
|
204
215
|
|
|
205
216
|
const handleOpenAddBusiness = () => {
|
|
206
|
-
|
|
217
|
+
setIsAdd(true)
|
|
207
218
|
handleClose()
|
|
208
219
|
}
|
|
209
220
|
|
|
@@ -231,6 +242,28 @@ const BusinessProductsListingUI = (props) => {
|
|
|
231
242
|
}
|
|
232
243
|
}, [businessState?.business])
|
|
233
244
|
|
|
245
|
+
useEffect(() => {
|
|
246
|
+
if (businessState.loading) return
|
|
247
|
+
const categoryId = query.get('category')
|
|
248
|
+
const productId = query.get('product')
|
|
249
|
+
if (categoryId && productId) {
|
|
250
|
+
const initCategory = businessState.business?.categories?.find(category => category.id === Number(categoryId))
|
|
251
|
+
const initProduct = initCategory?.products?.find(product => product.id === Number(productId))
|
|
252
|
+
if (initCategory) handleChangeCategory(null, initCategory)
|
|
253
|
+
if (initProduct) {
|
|
254
|
+
handleOpenProductDetails(initProduct, true)
|
|
255
|
+
}
|
|
256
|
+
} else if (categoryId && !productId) {
|
|
257
|
+
const initCategory = businessState.business?.categories?.find(category => category.id === Number(categoryId))
|
|
258
|
+
if (initCategory) {
|
|
259
|
+
handleChangeCategory(null, initCategory)
|
|
260
|
+
handleOpenCategoryDetails(initCategory, true)
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
businessState?.business?.categories && setCategorySelected(businessState?.business?.categories[0])
|
|
264
|
+
}
|
|
265
|
+
}, [businessState.loading])
|
|
266
|
+
|
|
234
267
|
return (
|
|
235
268
|
<>
|
|
236
269
|
<CategoryProductsContainer>
|
|
@@ -503,6 +536,14 @@ const BusinessProductsListingUI = (props) => {
|
|
|
503
536
|
getBusiness={getBusiness}
|
|
504
537
|
/>
|
|
505
538
|
</Modal>
|
|
539
|
+
<Modal
|
|
540
|
+
width='769px'
|
|
541
|
+
padding='30px'
|
|
542
|
+
open={isAdd}
|
|
543
|
+
onClose={() => setIsAdd(false)}
|
|
544
|
+
>
|
|
545
|
+
<BusinessAddStore />
|
|
546
|
+
</Modal>
|
|
506
547
|
</>
|
|
507
548
|
)
|
|
508
549
|
}
|
|
@@ -132,8 +132,8 @@ const BusinessPromotionGeneralFormUI = (props) => {
|
|
|
132
132
|
|
|
133
133
|
const handleChangeDates = (item) => {
|
|
134
134
|
handleChangeItem({
|
|
135
|
-
start: moment(item.selection.startDate).format('YYYY-MM-DD'),
|
|
136
|
-
end: item.selection.endDate ? moment(item.selection.endDate).format('YYYY-MM-DD') : null
|
|
135
|
+
start: moment(item.selection.startDate).format('YYYY-MM-DD 00:00:00'),
|
|
136
|
+
end: item.selection.endDate ? moment(item.selection.endDate).format('YYYY-MM-DD 23:59:59') : null
|
|
137
137
|
})
|
|
138
138
|
setDateRange([item.selection])
|
|
139
139
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useHistory, useLocation } from 'react-router-dom'
|
|
2
3
|
import {
|
|
3
4
|
useLanguage,
|
|
4
5
|
BusinessSharedMenuProducts as BusinessSharedMenuProductsController
|
|
@@ -25,26 +26,51 @@ const BusinessSharedMenuProductsUI = (props) => {
|
|
|
25
26
|
handleChangeInput
|
|
26
27
|
} = props
|
|
27
28
|
|
|
29
|
+
const history = useHistory()
|
|
30
|
+
const query = new URLSearchParams(useLocation().search)
|
|
28
31
|
const [, t] = useLanguage()
|
|
29
32
|
const { width } = useWindowSize()
|
|
30
33
|
const [searchValue, setSearchValue] = useState('')
|
|
31
34
|
const [currentProduct, setCurrentProduct] = useState(null)
|
|
32
35
|
const [isOpenDetails, setIsOpenDetails] = useState(false)
|
|
33
36
|
|
|
34
|
-
const handleOpenProduct = (e, product) => {
|
|
35
|
-
const isInvalid = e
|
|
37
|
+
const handleOpenProduct = (e, product, isInitialRender) => {
|
|
38
|
+
const isInvalid = e?.target?.closest('.product_checkbox')
|
|
36
39
|
if (isInvalid) return
|
|
37
40
|
setIsOpenSharedProduct(true)
|
|
38
41
|
setCurrentProduct(product)
|
|
39
42
|
setIsOpenDetails(true)
|
|
43
|
+
|
|
44
|
+
if (!isInitialRender) {
|
|
45
|
+
const businessId = query.get('id')
|
|
46
|
+
const section = query.get('section')
|
|
47
|
+
const tab = query.get('tab')
|
|
48
|
+
const menu = query.get('menu')
|
|
49
|
+
history.replace(`${location.pathname}?id=${businessId}§ion=${section}&tab=${tab}&menu=${menu}&product=${product.id}`)
|
|
50
|
+
}
|
|
40
51
|
}
|
|
41
52
|
|
|
42
53
|
const handleCloseSidebar = () => {
|
|
43
54
|
setIsOpenDetails(false)
|
|
44
55
|
setCurrentProduct(null)
|
|
45
56
|
setIsOpenSharedProduct(false)
|
|
57
|
+
const businessId = query.get('id')
|
|
58
|
+
const section = query.get('section')
|
|
59
|
+
const tab = query.get('tab')
|
|
60
|
+
const menu = query.get('menu')
|
|
61
|
+
history.replace(`${location.pathname}?id=${businessId}§ion=${section}&tab=${tab}&menu=${menu}`)
|
|
46
62
|
}
|
|
47
63
|
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const productId = query.get('product')
|
|
66
|
+
if (productId) {
|
|
67
|
+
const initProduct = menuState.menu.products.find(product => product.id === Number(productId))
|
|
68
|
+
if (initProduct) {
|
|
69
|
+
handleOpenProduct(null, initProduct, true)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, [])
|
|
73
|
+
|
|
48
74
|
return (
|
|
49
75
|
<>
|
|
50
76
|
<MenuProductsContainer>
|
|
@@ -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 { BusinessSyncBasic } from '../BusinessSyncBasic'
|
|
4
5
|
import { BusinessSyncItsaCheckmate } from '../BusinessSyncItsaCheckmate'
|
|
@@ -14,6 +15,8 @@ import {
|
|
|
14
15
|
export const BusinessSync = (props) => {
|
|
15
16
|
const { handleParentSidebarMove } = props
|
|
16
17
|
|
|
18
|
+
const history = useHistory()
|
|
19
|
+
const query = new URLSearchParams(useLocation().search)
|
|
17
20
|
const [, t] = useLanguage()
|
|
18
21
|
const [selectedOption, setSelectedOption] = useState('deliverect')
|
|
19
22
|
|
|
@@ -22,11 +25,24 @@ export const BusinessSync = (props) => {
|
|
|
22
25
|
{ key: 'itsacheckmate', name: t('ITSACHECKMATE', 'ItsaCheckmate') }
|
|
23
26
|
]
|
|
24
27
|
|
|
25
|
-
const handleChangeOption = (key) => {
|
|
28
|
+
const handleChangeOption = (key, isInitialRender) => {
|
|
26
29
|
handleParentSidebarMove(0)
|
|
27
30
|
setSelectedOption(key)
|
|
31
|
+
if (!isInitialRender) {
|
|
32
|
+
const header = query.get('header')
|
|
33
|
+
history.replace(`${location.pathname}?header=${header}&tab=${key}`)
|
|
34
|
+
}
|
|
28
35
|
}
|
|
29
36
|
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const tab = query.get('tab')
|
|
39
|
+
if (tab) {
|
|
40
|
+
handleChangeOption(tab, true)
|
|
41
|
+
} else {
|
|
42
|
+
handleChangeOption(selectedOption)
|
|
43
|
+
}
|
|
44
|
+
}, [])
|
|
45
|
+
|
|
30
46
|
return (
|
|
31
47
|
<Container>
|
|
32
48
|
<Header>
|