From 1d3247c03b86e30e37a7851d984edd2d1565bd82 Mon Sep 17 00:00:00 2001 From: manojava-gk Date: Thu, 24 Aug 2023 23:08:04 +0530 Subject: [PATCH] update(partnernetowrk): fix duplicate issue --- .../PartnerNetworksBPNTableColumns.tsx | 116 +++++++++--------- src/components/pages/PartnerNetwork/index.tsx | 14 +-- 2 files changed, 60 insertions(+), 70 deletions(-) diff --git a/src/components/pages/PartnerNetwork/components/PartnerList/PartnerNetworksBPNTableColumns.tsx b/src/components/pages/PartnerNetwork/components/PartnerList/PartnerNetworksBPNTableColumns.tsx index b607c0c81..b320ede44 100644 --- a/src/components/pages/PartnerNetwork/components/PartnerList/PartnerNetworksBPNTableColumns.tsx +++ b/src/components/pages/PartnerNetwork/components/PartnerList/PartnerNetworksBPNTableColumns.tsx @@ -19,21 +19,21 @@ ********************************************************************************/ import { GridColDef } from '@mui/x-data-grid' -import { IconButton } from '@catena-x/portal-shared-components' -import ArrowForwardIcon from '@mui/icons-material/ArrowForward' +// import { IconButton } from '@catena-x/portal-shared-components' +// import ArrowForwardIcon from '@mui/icons-material/ArrowForward' import { BusinessPartner } from 'features/newPartnerNetwork/types' -import { Box } from '@mui/material' -import smallLogo from '../../../../../assets/logo/cx-logo-short.svg' -import { OVERLAYS } from 'types/Constants' -import { show } from 'features/control/overlay' -import { useDispatch } from 'react-redux' +// import { Box } from '@mui/material' +// import smallLogo from '../../../../../assets/logo/cx-logo-short.svg' +// import { OVERLAYS } from 'types/Constants' +// import { show } from 'features/control/overlay' +// import { useDispatch } from 'react-redux' // Columns definitions of Partner Network page Data Grid export const PartnerNetworksBPNTableColumns = ( translationHook: any ): Array => { const { t } = translationHook() - const dispatch = useDispatch() + // const dispatch = useDispatch() return [ { @@ -50,55 +50,55 @@ export const PartnerNetworksBPNTableColumns = ( sortable: false, valueGetter: ({ row }: { row: BusinessPartner }) => row.bpnl, }, - { - field: 'cxmember', // Temporary field, doesnt exists yet - headerName: t('content.partnernetwork.columns.cxparticipant'), - flex: 1.5, - sortable: false, - renderCell: (params) => - params?.row?.member ? ( - - ) : ( - '' - ), - }, - { - field: 'country', - headerName: t('content.partnernetwork.columns.country'), - flex: 1.5, - sortable: false, - valueGetter: ({ row }: { row: BusinessPartner }) => - row?.legalAddress?.physicalPostalAddress?.country?.name ?? - row?.legalAddress?.alternativePostalAddress?.country?.name ?? - '', - }, - { - field: 'detail', - headerName: 'Detail', - headerAlign: 'center', - flex: 0.8, - align: 'center', - renderCell: (params) => - params?.row?.bpnl ? ( - dispatch(show(OVERLAYS.PARTNER, params.row.bpnl))} - > - - - ) : ( - <> - ), - }, + // { + // field: 'cxmember', // Temporary field, doesnt exists yet + // headerName: t('content.partnernetwork.columns.cxparticipant'), + // flex: 1.5, + // sortable: false, + // renderCell: (params) => + // params?.row?.member ? ( + // + // ) : ( + // '' + // ), + // }, + // { + // field: 'country', + // headerName: t('content.partnernetwork.columns.country'), + // flex: 1.5, + // sortable: false, + // valueGetter: ({ row }: { row: BusinessPartner }) => + // row?.legalAddress?.physicalPostalAddress?.country?.name ?? + // row?.legalAddress?.alternativePostalAddress?.country?.name ?? + // '', + // }, + // { + // field: 'detail', + // headerName: 'Detail', + // headerAlign: 'center', + // flex: 0.8, + // align: 'center', + // renderCell: (params) => + // params?.row?.bpnl ? ( + // dispatch(show(OVERLAYS.PARTNER, params.row.bpnl))} + // > + // + // + // ) : ( + // <> + // ), + // }, ] } diff --git a/src/components/pages/PartnerNetwork/index.tsx b/src/components/pages/PartnerNetwork/index.tsx index 40d52f713..4d6bfba96 100644 --- a/src/components/pages/PartnerNetwork/index.tsx +++ b/src/components/pages/PartnerNetwork/index.tsx @@ -26,12 +26,11 @@ import { } from 'features/newPartnerNetwork/partnerNetworkApiSlice' import { PageHeader } from '@catena-x/portal-shared-components' import { useSelector } from 'react-redux' -import { useEffect, useState } from 'react' +import { useState } from 'react' import { updatePartnerSelector } from 'features/control/updates' import { PartnerNetworksTableColumns } from 'components/pages/PartnerNetwork/partnerNetworkTableColumns' import { BusinessPartner } from 'features/newPartnerNetwork/types' import Patterns from 'types/Patterns' -import { PartnerNetworksBPNTableColumns } from './components/PartnerList/PartnerNetworksBPNTableColumns' import { useFetchMemberCompaniesQuery } from 'features/newPartnerNetwork/partnerNetworkPortalApiSlice' import { isContentPresent, @@ -47,17 +46,12 @@ const PartnerNetwork = () => { const [refresh, setRefresh] = useState(0) const searchInputData = useSelector(updatePartnerSelector) const columns = PartnerNetworksTableColumns(useTranslation) - const bpnColumns = PartnerNetworksBPNTableColumns(useTranslation) - const [showBPNColumn, setShowBPNColumn] = useState(false) const [mutationRequest] = useFetchBusinessPartnerAddressMutation() const { data } = useFetchMemberCompaniesQuery() const validateSearchText = (text: string): boolean => Patterns.SEARCH.test(text.trim()) - const checkIfBPNLNumber = (text: string): boolean => - Patterns.BPN.test(text.trim()) - const [allItems, setAllItems] = useState({}) const fetchAndApply = async (cData: any) => { @@ -100,10 +94,6 @@ const PartnerNetwork = () => { } } - useEffect(() => { - if (allItems?.length) setShowBPNColumn(checkIfBPNLNumber(expr)) - }, [allItems, expr]) - return (
{ fetchHookArgs={{ expr }} fetchHookRefresh={refresh} getRowId={(row: any) => row.bpnl ?? ''} - columns={!showBPNColumn ? columns : bpnColumns} + columns={columns} callbackToPage={fetchAndApply} allItems={allItems} />