Skip to content

Commit e626a0f

Browse files
authored
PIN-9124: changed text on create purpose page, added required on autocomplete input (PIN-9124) (#1657)
* feat: changed text on create purpose page, added required on autocomplete input (PIN-9124) * feat: added consumer purpose create page tests (PIN-9124)
1 parent 68e6121 commit e626a0f

File tree

7 files changed

+58
-11
lines changed

7 files changed

+58
-11
lines changed

src/components/shared/react-hook-form-inputs/RHFAutocomplete/_RHFAutocompleteBase.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export function _RHFAutocompleteBase<
118118
<TextField
119119
variant={variant}
120120
error={!!error}
121+
required={Boolean(rules?.required)}
121122
placeholder={placeholder ?? '...'}
122123
{...params}
123124
autoFocus={focusOnMount}

src/pages/ConsumerPurposeCreatePage/ConsumerPurposeCreate.page.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { PageContainer } from '@/components/layout/containers'
33
import { useTranslation } from 'react-i18next'
44
import { PurposeCreateForm } from './components/PurposeCreateForm'
55
import { useParams } from '@/router'
6+
import { Typography } from '@mui/material'
67

78
const ConsumerPurposeCreatePage: React.FC = () => {
89
const { t } = useTranslation('purpose')
@@ -16,6 +17,15 @@ const ConsumerPurposeCreatePage: React.FC = () => {
1617
to: 'SUBSCRIBE_PURPOSE_LIST',
1718
}}
1819
>
20+
<Typography
21+
sx={{
22+
fontSize: 16,
23+
fontWeight: 700,
24+
color: 'text.secondary',
25+
}}
26+
>
27+
{t('create.requiredLabel')}
28+
</Typography>
1929
<PurposeCreateForm purposeTemplateId={purposeTemplateId} />
2030
</PageContainer>
2131
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { describe, it, expect, vi } from 'vitest'
2+
import { screen } from '@testing-library/react'
3+
import ConsumerPurposeCreatePage from '../ConsumerPurposeCreate.page'
4+
import { mockUseJwt, renderWithApplicationContext } from '@/utils/testing.utils'
5+
6+
mockUseJwt()
7+
const useQueryMock = vi.fn()
8+
9+
describe('ConsumerPurposeCreatePage', () => {
10+
it('renders page title', () => {
11+
useQueryMock.mockReturnValue({
12+
isLoading: false,
13+
})
14+
15+
renderWithApplicationContext(<ConsumerPurposeCreatePage />, {
16+
withReactQueryContext: true,
17+
withRouterContext: true,
18+
})
19+
20+
expect(screen.getByText('create.emptyTitle')).toBeInTheDocument()
21+
})
22+
it('renders required label', () => {
23+
useQueryMock.mockReturnValue({
24+
isLoading: false,
25+
})
26+
27+
renderWithApplicationContext(<ConsumerPurposeCreatePage />, {
28+
withReactQueryContext: true,
29+
withRouterContext: true,
30+
})
31+
32+
expect(screen.getByText('create.requiredLabel')).toBeInTheDocument()
33+
})
34+
})

src/static/locales/en/purpose.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"backToListBtn": "Back to purposes",
33
"create": {
44
"emptyTitle": "Create purpose",
5-
"preliminaryInformationSectionTitle": "Preliminary information",
5+
"requiredLabel": "*Required fields.",
6+
"preliminaryInformationSectionTitle": "Purpose informations",
67
"isTemplateField": {
78
"label": "Clone from template"
89
},
@@ -13,11 +14,11 @@
1314
},
1415
"consumerField": {
1516
"label": "Consumer",
16-
"infoLabel": "Among the members, you can only select your organization or the members for whom you have an active delegation"
17+
"infoLabel": "Select your organization or the organization for which you have an active delegation as a consumer"
1718
},
1819
"eserviceField": {
1920
"label": "Choose e-service",
20-
"infoLabel": "You can only select the e-services for which the selected user has an active request for use",
21+
"infoLabel": "Here you will find only the e-services for which the consumer has an active request",
2122
"alert": {
2223
"label": "The facilitated compilation feature is available for the selected e-service!"
2324
}
@@ -44,7 +45,7 @@
4445
"riskAnalysisPreviewTitle": "Risk analysis",
4546
"purposeTemplateField": {
4647
"title": "Facilitated purpose compilation",
47-
"description": "The facilitated compilation feature provides annotations, supporting documents, and some pre-filled answers to help you formulate the risk analysis. The template is made available for reuse by other participating organizations and can be used without restrictions.",
48+
"description": "This feature guides you through the risk analysis with annotations, supporting documents, and some pre-populated responses. The simplified template is available for reuse by other producers and can be used without restrictions.",
4849
"usePurposeTemplateSwitch": {
4950
"label": "Use the facilitated compilation feature",
5051
"disabledTooltip": "It is not possible to use the feature for the selected \n e-service because the producer has not indicated how personal data will be processed",

src/static/locales/en/shared-components.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@
481481
"SUBSCRIBE_PURPOSE_EDIT": "Edit Purpose",
482482
"SUBSCRIBE_PURPOSE_SUMMARY": "Purpose Summary",
483483
"SUBSCRIBE_PURPOSE_DETAILS": "Manage Purpose",
484-
"SUBSCRIBE_PURPOSE_LIST": "Submitted Purposes",
484+
"SUBSCRIBE_PURPOSE_LIST": "Your Purposes",
485485
"SUBSCRIBE_CLIENT_OPERATOR_EDIT": "Manage E-service Client Operator",
486486
"SUBSCRIBE_CLIENT_KEY_EDIT": "Manage E-service Client Public Key",
487487
"SUBSCRIBE_CLIENT_CREATE": "Create E-service Client",

src/static/locales/it/purpose.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"backToListBtn": "Torna alle finalità",
33
"create": {
44
"emptyTitle": "Crea finalità",
5-
"preliminaryInformationSectionTitle": "Informazioni preliminari",
5+
"requiredLabel": "*Campi obbligatori.",
6+
"preliminaryInformationSectionTitle": "Informazioni sulla finalità",
67
"isTemplateField": {
78
"label": "Usa un template precompilato"
89
},
@@ -13,11 +14,11 @@
1314
},
1415
"consumerField": {
1516
"label": "Fruitore",
16-
"infoLabel": "Tra gli aderenti, puoi selezionare solo il tuo ente o gli aderenti per i quali hai una delega in fruizione attiva"
17+
"infoLabel": "Seleziona il tuo ente o l'ente per cui hai una delega attiva come fruitore"
1718
},
1819
"eserviceField": {
1920
"label": "E-service da associare",
20-
"infoLabel": "Puoi selezionare solo gli e-service per i quali il fruitore selezionato ha una richiesta di fruizione attiva",
21+
"infoLabel": "Qui trovi solo gli e-service per cui il fruitore ha una richiesta attiva",
2122
"alert": {
2223
"label": "Per l’e-service selezionato è possibile utilizzare la funzionalità di compilazione agevolata!"
2324
}
@@ -44,9 +45,9 @@
4445
"riskAnalysisPreviewTitle": "Analisi del rischio",
4546
"purposeTemplateField": {
4647
"title": "Compilazione agevolata della finalità",
47-
"description": "La funzionalità di compilazione agevolata mette a disposizione annotazioni, documenti di supporto e alcune risposte precompilate per facilitare la formulazione dell’analisi del rischio. Il modello è reso disponibile per il riuso da altri enti aderenti e può essere utilizzato senza vincoli.",
48+
"description": "Questa funzionalità ti guida durante l'analisi del rischio con annotazioni, documenti di supporto e alcune risposte precompilate. Il modello agevolato è reso disponibile per il riuso da altri enti e può essere usato senza vincoli.",
4849
"usePurposeTemplateSwitch": {
49-
"label": "Utilizza la funzionalità di compilazione agevolata",
50+
"label": "Usa la compilazione agevolata",
5051
"disabledTooltip": "Non è possibile utilizzare la funzionalità per \n l’e-service selezionato in quanto l’erogatore non ha indicato come verranno trattati i dati personali",
5152
"selectPurposeTemplate": {
5253
"title": "Scegli il modello di compilazione agevolata della finalità",

src/static/locales/it/shared-components.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@
481481
"SUBSCRIBE_PURPOSE_EDIT": "Modifica finalità",
482482
"SUBSCRIBE_PURPOSE_SUMMARY": "Riepilogo finalità",
483483
"SUBSCRIBE_PURPOSE_DETAILS": "Gestisci singola finalità",
484-
"SUBSCRIBE_PURPOSE_LIST": "Finalità inoltrate",
484+
"SUBSCRIBE_PURPOSE_LIST": "Le tue finalità",
485485
"SUBSCRIBE_CLIENT_OPERATOR_EDIT": "Gestisci operatore del client e-service",
486486
"SUBSCRIBE_CLIENT_KEY_EDIT": "Gestisci chiave pubblica del client e-service",
487487
"SUBSCRIBE_CLIENT_CREATE": "Crea client e-service",

0 commit comments

Comments
 (0)