Skip to content

Commit

Permalink
fix: worked on the PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamv-ss committed Dec 17, 2024
1 parent 528e46c commit 9e8aebb
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 30 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

### Bugfix

- refactor, optimise and reorganise the code in cax-companyData.tsx file [#317](https://github.com/eclipse-tractusx/portal-frontend-registration/pull/317)
- created a new component for form header to avoid duplication of code in each step [#310](https://github.com/eclipse-tractusx/portal-frontend-registration/pull/310)

## 2.1.0
Expand Down
3 changes: 1 addition & 2 deletions src/components/CompanyData/AddressForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/********************************************************************************
* Copyright (c) 2022 Microsoft and BMW Group AG
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down
10 changes: 3 additions & 7 deletions src/components/CompanyData/CompanyDataForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/********************************************************************************
* Copyright (c) 2022 Microsoft and BMW Group AG
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -70,7 +69,6 @@ const CompanyDataForm: React.FC<CompanyDataFormProps> = ({
if (isBPN(expr?.trim())) {
fetchData(expr).catch((errorCode: number) => {
setFields(null)
console.log('errorCode', errorCode)
setBpnErrorMessage(t('registrationStepOne.bpnNotExistError'))
})
setBpnErrorMessage('')
Expand Down Expand Up @@ -109,8 +107,7 @@ const CompanyDataForm: React.FC<CompanyDataFormProps> = ({
{t('registrationStepOne.bpn')}{' '}
<AiOutlineQuestionCircle
color="#939393"
// tip data need to get moved to the locales files
data-tip="Displays the bpn and can't get eddited."
data-tip={t('registrationStepOne.bpnTooltip')}
/>
</label>
<input type="text" disabled value={bpn} />
Expand All @@ -128,8 +125,7 @@ const CompanyDataForm: React.FC<CompanyDataFormProps> = ({
<span className="mandatory-asterisk">*</span>
<AiOutlineQuestionCircle
color="#939393"
// tip data need to get moved to the locales files
data-tip="Legal Company Name"
data-tip={t('registrationStepOne.legalEntityTooltip')}
/>{' '}
</label>
<input
Expand Down
4 changes: 1 addition & 3 deletions src/components/CompanyData/Identiifier.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/********************************************************************************
* Copyright (c) 2022 Microsoft and BMW Group AG
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* Copyright (c) 2024 Contributors to the Eclipse Foundation
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
Expand Down
4 changes: 1 addition & 3 deletions src/helpers/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/********************************************************************************
* Copyright (c) 2022 Microsoft and BMW Group AG
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* Copyright (c) 2024 Contributors to the Eclipse Foundation
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
Expand Down
24 changes: 11 additions & 13 deletions src/helpers/validation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/********************************************************************************
* Copyright (c) 2022 Microsoft and BMW Group AG
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* Copyright (c) 2024 Contributors to the Eclipse Foundation
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
Expand Down Expand Up @@ -30,9 +28,9 @@ const validate = (

export const validateLegalEntity = (
value: string,
setLegalEntity: any,
setErrors: any
) => {
setLegalEntity: (value: string) => void,
setErrors: (errors) => void
): void => {
setLegalEntity(value)
validate(value, Patterns.legalEntityPattern, 'legalEntityError', (error) => {
setErrors((prevState) => ({
Expand All @@ -44,8 +42,8 @@ export const validateLegalEntity = (

export const validateRegisteredName = (
value: string,
setRegisteredName: any,
setErrors: any
setRegisteredName: (value: string) => void,
setErrors: (errors) => void
) => {
setRegisteredName(value)
validate(
Expand All @@ -63,8 +61,8 @@ export const validateRegisteredName = (

export const validatePostalCode = (
value: string,
setPostalCode: any,
setErrors: any
setPostalCode: (value: string) => void,
setErrors: (errors) => void
) => {
setPostalCode(value)
validate(value, Patterns.postalCodePattern, 'postalCodeError', (error) => {
Expand All @@ -75,7 +73,7 @@ export const validatePostalCode = (
})
}

export const validateCity = (value: string, setCity: any, setErrors: any) => {
export const validateCity = (value: string, setCity: (value: string) => void, setErrors: (errors)=>void) => {
setCity(value)
validate(value, Patterns.CITY, 'cityError', (error) => {
setErrors((prevState) => ({
Expand All @@ -87,8 +85,8 @@ export const validateCity = (value: string, setCity: any, setErrors: any) => {

export const validateStreetHouseNumber = (
value: string,
setStreetHouseNumber: any,
setErrors: any
setStreetHouseNumber: (value: string) => void,
setErrors: (errors) => void
) => {
setStreetHouseNumber(value)
validate(value, Patterns.STREET, 'streetHouseNumberError', (error) => {
Expand Down
2 changes: 1 addition & 1 deletion src/locales/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"bpnInvalidError": "The BPN is invalid, please enter a valid BPN or use the manual flow below. Hint: A BPN has 16-digits.",
"bpnNotExistError": "This BPN doesn't exist, please enter a valid BPN or use the manual flow below.",
"legalEntityError": "Bitte geben Sie einen gültigen Wert für die juristische Person ein.",
"registerdNameError": "Bitte geben Sie einen gültigen registrierten Namen ein.",
"registeredNameError": "Bitte geben Sie einen gültigen registrierten Namen ein.",
"streetHouseNumberError": "Bitte geben Sie eine gültige Straße und Hausnummer ein.",
"regionError": "Bitte geben Sie einen gültigen Region.",
"postalCodeError": "Bitte geben Sie eine gültige Postleitzahl ein.",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"seachDatabase": "Search for your company data by BPN to autofill the relevant data fields",
"enterManualText": "or enter your data manually:",
"bpn": "Business Partner Number",
"bpnTooltip": "Displays the bpn and can't get eddited.",
"legalEntity": "Legal Entity Name",
"legalEntityTooltip": "Legal Company Name",
"helperText": "In case you enter your data manually, this field fill be locked.",
"registeredName": "Registered Name",
"organizationAdd": "Organization Address",
Expand Down

0 comments on commit 9e8aebb

Please sign in to comment.