Skip to content

Commit

Permalink
new: introduced new field of customer contact in service
Browse files Browse the repository at this point in the history
  • Loading branch information
Usmanfee committed Oct 10, 2024
1 parent 5958ffe commit 1fbc655
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/assets/locales/de/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@
"providerPhoneContact": "Provider Phone Contact",
"pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net",
"pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail",
"pleaseEnterValidPhone": "Please enter a valid Customer Contact Number",
"pleaseEnterValidContact": "Bitte fügen Sie eine gültige Telefonnummer im folgenden Format hinzu: „+ xx xxxx xxxxxx“, „+ xxx xxxx-xxxx“, „+xx xxxxxxxxxx“. Hinweis: Es sind weitere Formate zulässig. Die genannten Formate sind die am häufigsten verwendeten Formate.",
"privacyInformation": "Privacy Information",
"privacyInformationDescription": "The privacy information is used to display data types the app may collect on the app detail page. You may select several options OR select “none”.",
Expand Down Expand Up @@ -1661,7 +1662,7 @@
"appProvider": "App Provider",
"website": "Website",
"email": "Email",
"phone": "Phone"
"phone": "Telefon"
}
},
"checklistOverlay": {
Expand Down
11 changes: 8 additions & 3 deletions src/assets/locales/de/servicerelease.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@
"note": "Info:",
"providerDetails": "Provider Details",
"providerHomePage": "Provider Homepage",
"providerContactEmail": "Customer Contact E-Mail",
"providerContactEmail": "Kundenkontakt E-Mail",
"providerContactPhone": "Kundenkontakt Telefon",
"pleaseEnterValidHomePageURL": "Bitte geben Sie eine gültige URL ein - eg: https://catena-x.net",
"pleaseEnterValidEmail": "Bitte geben Sie eine gültige Email an"
"pleaseEnterValidEmail": "Bitte geben Sie eine gültige Email an",
"pleaseEnterValidPhone": "Bitte geben Sie eine gültige Kundenkontakt Telefonnummer ein"
},
"step3": {
"headerTitle": "Agreements and Consent",
Expand All @@ -76,7 +78,10 @@
"longDescriptionTitleEN": "[Long Description - EN] ",
"longDescriptionTitleDE": "[Long Description - DE] ",
"conformityDocument": "Conformity Document",
"conformityDocumentsDescription": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
"conformityDocumentsDescription": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
"website": "Webseite",
"email": "E-Mail",
"phone": "Telefon"
},
"serviceReleaseForm": {
"headerTitle": "Create Service",
Expand Down
1 change: 1 addition & 0 deletions src/assets/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@
"providerPhoneContact": "Contac (Phone Number)",
"pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net",
"pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail",
"pleaseEnterValidPhone": "Please enter a valid Customer Contact Number",
"pleaseEnterValidContact": "Please add a valid phone number and in the following format: “+ xx xxxx xxxxxx”, “+ xxx xxxx-xxxx”, “+xx xxxxxxxxxx”. Note: more formats are allowed, mentioned formats are the most used formats.",
"privacyInformation": "Privacy Information",
"privacyInformationDescription": "The privacy information is used to display data types the app may collect on the app detail page. You may select several options OR select “none”.",
Expand Down
9 changes: 7 additions & 2 deletions src/assets/locales/en/servicerelease.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@
"providerDetails": "Provider Details",
"providerHomePage": "Provider Homepage",
"providerContactEmail": "Customer Contact E-Mail",
"providerContactPhone": "Customer Contact Phone",
"pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net",
"pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail"
"pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail",
"pleaseEnterValidPhone": "Please enter a valid Customer Contact Phonenumber"
},
"step3": {
"headerTitle": "Agreements and Consent",
Expand All @@ -76,7 +78,10 @@
"longDescriptionTitleEN": "[Long Description - EN] ",
"longDescriptionTitleDE": "[Long Description - DE] ",
"conformityDocument": "Conformity Document",
"conformityDocumentsDescription": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
"conformityDocumentsDescription": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
"website": "Provider HomePage",
"email": "E-Mail",
"phone": "Phone"
},
"serviceReleaseForm": {
"headerTitle": "Create service",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,21 @@ export default function ServiceDetails() {
<Typography variant="h4" sx={{ mb: 4 }}>
{t('step4.providerInformation')}
</Typography>

{/* "website": "Webseite",
"email": "E-Mail",
"phone": "Telefon" */}
<StaticTable
data={{
head: ['Homepage', 'E-Mail'],
head: [
t('step4.website'),
t('step4.email'),
t('step4.phone'),
],
body: [
[fetchServiceStatus?.providerUri],
[fetchServiceStatus?.contactEmail],
[fetchServiceStatus?.contactNumber],
],
}}
horizontal={true}
Expand Down
18 changes: 18 additions & 0 deletions src/components/shared/basic/ReleaseProcess/OfferPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type FormDataType = {
images: []
providerHomePage: string
providerContactEmail: string
providerPhoneContact: string
}

export default function OfferPage({
Expand Down Expand Up @@ -117,6 +118,7 @@ export default function OfferPage({
images: fetchServiceStatus?.documents?.ADDITIONAL_DETAILS ?? [],
providerHomePage: fetchServiceStatus?.providerUri ?? '',
providerContactEmail: fetchServiceStatus?.contactEmail ?? '',
providerPhoneContact: fetchServiceStatus?.contactNumber ?? '',
}
}, [fetchServiceStatus])

Expand Down Expand Up @@ -215,6 +217,7 @@ export default function OfferPage({
'longDescriptionDE',
'providerHomePage',
'providerContactEmail',
'providerPhoneContact',
])
if (validateFields) {
setLoading(true)
Expand Down Expand Up @@ -249,6 +252,7 @@ export default function OfferPage({
price: '',
providerUri: data.providerHomePage ?? '',
contactEmail: data.providerContactEmail ?? '',
contactNumber: data.providerPhoneContact ?? '',
leadPictureUri: fetchServiceStatus?.leadPictureUri,
}

Expand Down Expand Up @@ -392,6 +396,20 @@ export default function OfferPage({
ruleMessage={t('step2.pleaseEnterValidEmail')}
/>
</div>

<div className="form-field">
<ProviderConnectorField
{...{
control,
trigger,
errors,
}}
name="providerPhoneContact"
label={t('step2.providerContactPhone')}
pattern={Patterns.PHONE}
ruleMessage={t('step2.pleaseEnterValidPhone')}
/>
</div>
</form>
<SnackbarNotificationWithButtons
pageNotification={appPageNotification}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ export default function OfferValidateAndPublish({
conformityDocumentsDescription: t('step4.conformityDocumentsDescription'),
documentsDescription: t('defaultValues.documentsDescription'),
providerTableData: {
head: ['Homepage', 'E-Mail'],
head: [t('step4.website'), t('step4.email'), t('step4.phone')],
body: [
[fetchServiceStatus?.providerUri],
[fetchServiceStatus?.contactEmail],
[fetchServiceStatus?.contactNumber],
],
},
}
Expand Down
13 changes: 13 additions & 0 deletions src/types/Patterns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
isCountryCode,
isClientID,
isPersonName,
isValidPhone,
} from './Patterns'

const TESTDATA = {
Expand Down Expand Up @@ -67,6 +68,10 @@ const TESTDATA = {
'@mickey.mouse',
],
},
PHONE: {
valid: ['+1 1234567890', '015208561328', '00491522345678'],
invalid: ['12345', '12345123aa'],
},
DOMAIN: {
valid: [
'www.bmw.de',
Expand Down Expand Up @@ -304,4 +309,12 @@ describe('Input Pattern Tests', () => {
expect(isClientID(expr)).toBe(false)
})
})
it('validate phone number', () => {
TESTDATA.PHONE.valid.forEach((expr) => {
expect(isValidPhone(expr)).toBe(true)
})
TESTDATA.CLIENTID.invalid.forEach((expr) => {
expect(isValidPhone(expr)).toBe(false)
})
})
})
2 changes: 2 additions & 0 deletions src/types/Patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const Patterns = {
LABEL: /^[a-z0-9-_ ]{1,80}$/i,
BPN: /^BPNL[0-9A-Z]{12}$/i,
MAIL: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*))@(([a-z0-9-]+\.)+[a-z]{2,})$/,
PHONE: /^(\+|00)?(?:[0-9] ?){6,14}[0-9]$/,
DOMAIN: new RegExp(`^${DOMAIN.source}$`, 'i'),
PATH: new RegExp(`^${URLPATH.source}$`, 'i'),
URL: urlPattern,
Expand Down Expand Up @@ -208,5 +209,6 @@ export const isCompanyVies = (expr: string) =>
Patterns.companyData.VIES.test(expr)
export const isPostalCode = (expr: string) =>
Patterns.companyData.POSTAL_CODE.test(expr)
export const isValidPhone = (expr: string) => Patterns.PHONE.test(expr)

export default Patterns

0 comments on commit 1fbc655

Please sign in to comment.