Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PN-10623): implement field for senderDenomination #1186

Merged
merged 19 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
32a45f2
feat(PN-10623): wip on new field for senderDenomination
SarahDonvito Apr 11, 2024
7821559
feat(PN-10623): wip on senderDenomination field for PA
SarahDonvito Apr 12, 2024
134e8e5
Merge branch 'develop' of github.com:pagopa/pn-frontend into fix/PN-1…
SarahDonvito Apr 16, 2024
272912a
Merge branch 'develop' of github.com:pagopa/pn-frontend into fix/PN-1…
SarahDonvito Apr 17, 2024
55059e0
feat(PN-10623): wip on senderDenomination field
SarahDonvito Apr 17, 2024
f062e78
Merge branch 'develop' of github.com:pagopa/pn-frontend into fix/PN-1…
SarahDonvito Apr 17, 2024
10d477c
feat(PN-10623): fix field for senderDenomination
SarahDonvito Apr 17, 2024
dc79735
feat(PN-10623): fix on tests
SarahDonvito Apr 17, 2024
f62d712
feat(PN-10263): fix on tests
SarahDonvito Apr 17, 2024
2e80c99
Merge branch 'develop' of github.com:pagopa/pn-frontend into fix/PN-1…
SarahDonvito Apr 17, 2024
98a7230
feat(PN-10623): change request
SarahDonvito Apr 17, 2024
0801c40
feat(PN-10263): wip on tests
SarahDonvito Apr 17, 2024
e3dd060
Merge branch 'develop' of github.com:pagopa/pn-frontend into fix/PN-1…
SarahDonvito Apr 17, 2024
0810853
feat(PN-10623): fix on tests
SarahDonvito Apr 18, 2024
2b2aaba
feat(PN-10623): wip on senderDenomination field
SarahDonvito Apr 18, 2024
a4f6182
feat(PN-10623): use rootParent in senderDenomination
SarahDonvito Apr 19, 2024
a669103
feat(PN-10623): remove useless comment
SarahDonvito Apr 19, 2024
1c99c09
fix(PN-10623): update user type and organization type in PA
SarahDonvito Apr 22, 2024
b0fdacf
chore: added missing properties defined in schema
ZorbaDimatteo Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/pn-pa-webapp/public/locales/it/notifiche.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
"title": "Informazioni preliminari",
"protocol-number": "Numero di protocollo",
"subject": "Oggetto della notifica",
"sender-denomination": "Ente mittente",
"abstract": "Descrizione",
"group": "Gruppo",
"no-groups": "Non ci sono gruppi per questo prodotto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export const newNotificationEmpty: NewNotification = {
group: '',
taxonomyCode: '',
notificationFeePolicy: '' as NotificationFeePolicy,
senderDenomination: '',
};

export const newNotificationDTO: NewNotificationDTO = newNotificationMapper(newNotification);
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ const PreliminaryInformations = ({ notification, onConfirm }: Props) => {
(state: RootState) => state.userState.user.organization.hasGroups
);

const senderDenomination = useAppSelector((state: RootState) =>
state.userState.user.organization.parentDescription
? state.userState.user.organization.parentDescription +
' - ' +
state.userState.user.organization.name
: state.userState.user.organization.name
);

const { t } = useTranslation(['notifiche'], {
keyPrefix: 'new-notification.steps.preliminary-informations',
});
Expand All @@ -64,6 +72,7 @@ const PreliminaryInformations = ({ notification, onConfirm }: Props) => {
() => ({
paProtocolNumber: notification.paProtocolNumber || '',
subject: notification.subject || '',
senderDenomination,
abstract: notification.abstract ?? '',
group: notification.group ?? '',
taxonomyCode: notification.taxonomyCode || '',
Expand All @@ -76,6 +85,7 @@ const PreliminaryInformations = ({ notification, onConfirm }: Props) => {
const validationSchema = yup.object({
paProtocolNumber: requiredStringFieldValidation(tc, 256),
subject: requiredStringFieldValidation(tc, 134, 10),
senderDenomination: requiredStringFieldValidation(tc, 80),
abstract: yup
.string()
.max(1024, tc('too-long-field-error', { maxLength: 1024 }))
Expand Down Expand Up @@ -125,6 +135,13 @@ const PreliminaryInformations = ({ notification, onConfirm }: Props) => {
fetchGroups();
}, [fetchGroups]);

const isLessThan80Chars = (field: string | undefined) => {
if (field) {
return field.length < 80;
} else {
return false;
}
};
return (
<ApiErrorWrapper
apiId={NEW_NOTIFICATION_ACTIONS.GET_USER_GROUPS}
Expand Down Expand Up @@ -158,6 +175,26 @@ const PreliminaryInformations = ({ notification, onConfirm }: Props) => {
size="small"
margin="normal"
/>
<TextField
id="senderDenomination"
label={`${t('sender-denomination')}*`}
fullWidth
name="senderDenomination"
value={formik.values.senderDenomination}
onChange={handleChangeTouched}
error={
!isLessThan80Chars(formik.values.senderDenomination) &&
Boolean(formik.errors.senderDenomination)
}
disabled={isLessThan80Chars(notification.senderDenomination)}
helperText={
(!isLessThan80Chars(formik.values.senderDenomination) &&
formik.errors.senderDenomination) ||
(formik.touched.senderDenomination && formik.errors.senderDenomination)
}
size="small"
margin="normal"
/>
<TextField
id="abstract"
label={t('abstract')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const populateForm = async (form: HTMLFormElement, hasPayment: boolean) => {
await testInput(form, 'paProtocolNumber', newNotification.paProtocolNumber);
await testInput(form, 'subject', newNotification.subject);
await testInput(form, 'taxonomyCode', newNotification.taxonomyCode);
await testInput(form, 'senderDenomination', newNotification.senderDenomination);
await testSelect(
form,
'group',
Expand Down Expand Up @@ -196,6 +197,7 @@ describe('PreliminaryInformations component with payment enabled', async () => {
recipients: [],
physicalCommunicationType: PhysicalCommunicationType.AR_REGISTERED_LETTER,
paymentMode: PaymentModel.PAGO_PA_NOTICE_F24_FLATRATE,
senderDenomination: newNotification.senderDenomination,
});
});
expect(confirmHandlerMk).toBeCalledTimes(1);
Expand Down Expand Up @@ -420,6 +422,7 @@ describe('PreliminaryInformations Component with payment disabled', async () =>
recipients: [],
physicalCommunicationType: PhysicalCommunicationType.AR_REGISTERED_LETTER,
paymentMode: PaymentModel.NOTHING,
senderDenomination: newNotification.senderDenomination,
});
});
expect(confirmHandlerMk).toBeCalledTimes(1);
Expand Down
4 changes: 2 additions & 2 deletions packages/pn-pa-webapp/src/models/NewNotification.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
DigitalDomicileType,
NotificationDetailDocument,
NotificationDetailRecipient,
NotificationFeePolicy,
PhysicalCommunicationType,
RecipientType,
NotificationDetailDocument,
} from '@pagopa-pn/pn-commons';

export enum PaymentModel {
Expand All @@ -22,7 +22,7 @@ interface BaseNewNotification {
abstract?: string;
cancelledIun?: string;
physicalCommunicationType: PhysicalCommunicationType;
senderDenomination?: string;
senderDenomination: string;
senderTaxId?: string;
group?: string;
taxonomyCode: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const initialState = {
group: '',
taxonomyCode: '',
notificationFeePolicy: '',
senderDenomination: '',
},
groups: [],
isCompleted: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const initialState = {
taxonomyCode: '',
paymentMode: '' as PaymentModel,
notificationFeePolicy: '' as NotificationFeePolicy,
senderDenomination: '',
} as NewNotification,
groups: [] as Array<UserGroup>,
isCompleted: false,
Expand Down
61 changes: 9 additions & 52 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2852,7 +2852,7 @@
"@types/react" "*"
hoist-non-react-statics "^3.3.0"

"@types/istanbul-lib-coverage@^2.0.0":
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
version "2.0.6"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7"
integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==
Expand All @@ -2862,6 +2862,13 @@
resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz"
integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==

"@types/istanbul-lib-report@*":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf"
integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==
dependencies:
"@types/istanbul-lib-coverage" "*"

"@types/istanbul-reports@^3.0.0":
version "3.0.4"
resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54"
Expand Down Expand Up @@ -3541,11 +3548,6 @@ available-typed-arrays@^1.0.5:
resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7"
integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==

[email protected]:
version "4.4.1"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.4.1.tgz#7dbdc25989298f9ad006645cd396782443757413"
integrity sha512-gd1kmb21kwNuWr6BQz8fv6GNECPBnUasepcoLbekws23NVBLODdsClRZ+bQ8+9Uomf3Sm3+Vwn0oYG9NvwnJCw==

axios-mock-adapter@^1.22.0:
version "1.22.0"
resolved "https://registry.yarnpkg.com/axios-mock-adapter/-/axios-mock-adapter-1.22.0.tgz#0f3e6be0fc9b55baab06f2d49c0b71157e7c053d"
Expand Down Expand Up @@ -4438,11 +4440,6 @@ detect-indent@^5.0.0:
resolved "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz"
integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50=

diff-sequences@^27.5.1:
version "27.5.1"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327"
integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==

diff-sequences@^29.6.3:
version "29.6.3"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921"
Expand Down Expand Up @@ -6259,26 +6256,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59"
integrity sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==

jest-axe@^6.0.0:
version "6.0.1"
resolved "https://registry.yarnpkg.com/jest-axe/-/jest-axe-6.0.1.tgz#54a8b7dc09afd6190b21f38b51b8bddc2d923834"
integrity sha512-+KcRAdZeKXBbtHTmMkokRq5/hXHaVFpX+WS2o3uvhkmF3szdr4+TYAz+QuOTeM0B1d4YPoNmQWhGzSzxHJNZrA==
dependencies:
axe-core "4.4.1"
chalk "4.1.0"
jest-matcher-utils "27.0.2"
lodash.merge "4.6.2"

jest-diff@^27.0.0, jest-diff@^27.0.2:
version "27.5.1"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.5.1.tgz#a07f5011ac9e6643cf8a95a462b7b1ecf6680def"
integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==
dependencies:
chalk "^4.0.0"
diff-sequences "^27.5.1"
jest-get-type "^27.5.1"
pretty-format "^27.5.1"

jest-diff@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a"
Expand All @@ -6289,26 +6266,11 @@ jest-diff@^29.7.0:
jest-get-type "^29.6.3"
pretty-format "^29.7.0"

jest-get-type@^27.0.1, jest-get-type@^27.5.1:
version "27.5.1"
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.5.1.tgz#3cd613c507b0f7ace013df407a1c1cd578bcb4f1"
integrity sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==

jest-get-type@^29.6.3:
version "29.6.3"
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1"
integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==

[email protected]:
version "27.0.2"
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.0.2.tgz#f14c060605a95a466cdc759acc546c6f4cbfc4f0"
integrity sha512-Qczi5xnTNjkhcIB0Yy75Txt+Ez51xdhOxsukN7awzq2auZQGPHcQrJ623PZj0ECDEMOk2soxWx05EXdXGd1CbA==
dependencies:
chalk "^4.0.0"
jest-diff "^27.0.2"
jest-get-type "^27.0.1"
pretty-format "^27.0.2"

jest-matcher-utils@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12"
Expand Down Expand Up @@ -6686,11 +6648,6 @@ lodash.ismatch@^4.4.0:
resolved "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz"
integrity sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc=

[email protected]:
version "4.6.2"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==

lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
Expand Down Expand Up @@ -7991,7 +7948,7 @@ [email protected]:
ansi-styles "^5.0.0"
react-is "^18.0.0"

pretty-format@^27.0.0, pretty-format@^27.0.2, pretty-format@^27.5.1:
pretty-format@^27.0.2:
version "27.5.1"
resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz"
integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==
Expand Down