From 5a2f397a12f3072e9f63cdc6d95515c786ef5fc9 Mon Sep 17 00:00:00 2001
From: Manojava Koushik <111366021+manojava-gk@users.noreply.github.com>
Date: Mon, 7 Oct 2024 20:26:33 +0530
Subject: [PATCH] feat(company data): re-enable csv upload and revert setting
of ready state (#1144)
enabled feature is needed for R24.12 and setting of ready state is now taken care of from BDPM side due to changed configuration
---
CHANGELOG.md | 3 +++
.../components/CompanyAddressList.tsx | 8 +++++++
.../pages/CompanyData/components/EditForm.tsx | 21 ++-----------------
3 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 134a26bee..8907b976d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,9 @@
- updated technical user details with user type and service endpoint fields. Also, updated copy icon color for better view and made copy icon available only when value is available [#1137](https://github.com/eclipse-tractusx/portal-frontend/pull/1137)
- **Company Subscriptions**
- update API query parameters and fix tab UI scroll [#1131](https://github.com/eclipse-tractusx/portal-frontend/pull/1131)
+- **Customer Data**
+ - re-enabled CSV upload [#1144](https://github.com/eclipse-tractusx/portal-frontend/pull/1144)
+ - reverted manual intervention with ready state api [#1144](https://github.com/eclipse-tractusx/portal-frontend/pull/1144)
- **Onboarding Service Provider**
- enhanced permission and company role validation for Onboarding Service Provider [#1176](https://github.com/eclipse-tractusx/portal-frontend/pull/1176)
diff --git a/src/components/pages/CompanyData/components/CompanyAddressList.tsx b/src/components/pages/CompanyData/components/CompanyAddressList.tsx
index 1c490f1fc..1505ee887 100644
--- a/src/components/pages/CompanyData/components/CompanyAddressList.tsx
+++ b/src/components/pages/CompanyData/components/CompanyAddressList.tsx
@@ -46,6 +46,9 @@ import {
} from 'features/companyData/slice'
import { statusColorMap } from 'utils/dataMapper'
import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'
+import { show } from 'features/control/overlay'
+import { OVERLAYS } from 'types/Constants'
+import UploadIcon from '@mui/icons-material/Upload'
export const CompanyAddressList = ({
handleButtonClick,
@@ -195,6 +198,11 @@ export const CompanyAddressList = ({
},
icon: ,
},
+ {
+ title: t('content.companyData.csvUploadBtn'),
+ click: () => dispatch(show(OVERLAYS.CSV_UPLOAD_OVERLAY)),
+ icon: ,
+ },
]}
autoFocus={false}
onButtonClick={handleButtonClick}
diff --git a/src/components/pages/CompanyData/components/EditForm.tsx b/src/components/pages/CompanyData/components/EditForm.tsx
index 8fb21b180..37cee254b 100644
--- a/src/components/pages/CompanyData/components/EditForm.tsx
+++ b/src/components/pages/CompanyData/components/EditForm.tsx
@@ -35,7 +35,6 @@ import {
type CompanyDataType,
useUpdateCompanySiteAndAddressMutation,
type CompanyDataFieldsType,
- useUpdateCompanyStatusToReadyMutation,
} from 'features/companyData/companyDataApiSlice'
import { useSelector } from 'react-redux'
import {
@@ -68,7 +67,6 @@ export default function EditForm({
const [loading, setLoading] = useState(false)
const [isValid, setIsValid] = useState(false)
const [updateData] = useUpdateCompanySiteAndAddressMutation()
- const [updateReadyState] = useUpdateCompanyStatusToReadyMutation()
const companyData = useSelector(companyDataSelector)
const [success, setSuccess] = useState(false)
const [error, setError] = useState(false)
@@ -123,11 +121,9 @@ export default function EditForm({
}
}
- const updateStateToReady = async (response: CompanyDataType[]) => {
+ const handleCreation = async () => {
try {
- await updateReadyState({
- externalIds: [response[0].externalId],
- })
+ await updateData([input])
.unwrap()
.then(() => {
setSuccess(true)
@@ -138,19 +134,6 @@ export default function EditForm({
setLoading(false)
}
- const handleCreation = async () => {
- try {
- await updateData([input])
- .unwrap()
- .then((response) => {
- updateStateToReady(response)
- })
- } catch (e) {
- setError(true)
- setLoading(false)
- }
- }
-
const getTitle = () => {
if (newForm) {
return isAddress