Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 src/pages/addUserFlow/addUser/AddProductToUserPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ function AddProductToUserPage({ party, activeProducts, productsRolesMap, partyUs
certifiedName: false,
certifiedSurname: false,
certifiedMail: false,
toAddOnAggregates: false,
} as PartyUserOnCreation
}
canEditRegistryData={false}
Expand Down
1 change: 1 addition & 0 deletions src/pages/addUserFlow/addUser/AddUsersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export default function AddUsersPage({ party, activeProducts, productsRolesMap }
certifiedName: false,
certifiedSurname: false,
productRoles: [],
toAddOnAggregates: false,
}}
canEditRegistryData={true}
forwardNextStep={forwardNextStep}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { Button, Grid, Radio, RadioGroup, Stack, Typography } from '@mui/material';
import {
Button,
FormControlLabel,
Grid,
Radio,
RadioGroup,
Stack,
Typography,
} from '@mui/material';
import { usePermissions } from '@pagopa/selfcare-common-frontend/lib';
import useErrorDispatcher from '@pagopa/selfcare-common-frontend/lib/hooks/useErrorDispatcher';
import useLoading from '@pagopa/selfcare-common-frontend/lib/hooks/useLoading';
Expand Down Expand Up @@ -27,7 +35,6 @@ import {
} from '../../../../../utils/constants';
import {
commonStyles,
CustomFormControlLabel,
getProductLink,
RadioOptionLabel,
renderLabel,
Expand Down Expand Up @@ -403,13 +410,15 @@ export default function AddUserForm({
formik={formik}
validTaxcode={validTaxcode}
setIsAddInBulkEAFlow={setIsAddInBulkEAFlow}
isAdminEaOnProdIO={isAdminEaOnProdIO}
setIsAsyncFlow={setIsAsyncFlow}
userProduct={userProduct}
party={party}
renderLabel={renderLabel}
t={t}
/>
)}
{/* TODO enable after groups automation is in placeS */}
{isAdminEaOnProdIO &&
userProduct?.id === PRODUCT_IDS.IO &&
formik.values.productRoles.length > 0 && (
Expand All @@ -420,24 +429,25 @@ export default function AddUserForm({
</Typography>
</Grid>
<Grid item xs={12} mb={1}>
<RadioGroup>
<RadioGroup value={false}>
{EA_RADIO_OPTIONS.map(({ value, titleKey, descriptionKey }) => (
<CustomFormControlLabel
<FormControlLabel
key={value.toString()}
sx={{ marginBottom: 2 }}
value={value}
disabled={!validTaxcode}
disabled
control={<Radio />}
label={
<RadioOptionLabel
titleKey={titleKey}
descriptionKey={descriptionKey}
disabled={!validTaxcode}
disabled={true}
t={t}
/>
}
aria-label={t(titleKey)}
onClick={async () => {
// TODO set isAddINBulkEAFlow only for role admin not operator
setIsAddInBulkEAFlow(value);
await formik.setFieldValue('toAddOnAggregates', value, true);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface ProductRolesSectionProps {
formik: FormikProps<PartyUserOnCreation>;
validTaxcode: string | undefined;
setIsAddInBulkEAFlow: (value: SetStateAction<boolean>) => void;
isAdminEaOnProdIO: boolean;
setIsAsyncFlow: (value: SetStateAction<boolean>) => void;
userProduct: Product | undefined;
renderLabel: (role: ProductRole, enabled: boolean) => any;
Expand All @@ -31,6 +32,7 @@ export const ProductRolesSection = ({
formik,
validTaxcode,
setIsAddInBulkEAFlow,
isAdminEaOnProdIO,
setIsAsyncFlow,
userProduct,
party,
Expand Down Expand Up @@ -113,12 +115,15 @@ export const ProductRolesSection = ({
validTaxcode
? async () => {
await addRole(p);
setIsAddInBulkEAFlow(
p?.phasesAdditionAllowed.includes('dashboard-aggregator') &&
party.products.some(
(p) => p.productId === userProduct?.id && p.isAggregator
)
);
if (!isAdminEaOnProdIO) {
setIsAddInBulkEAFlow(
p?.phasesAdditionAllowed.includes('dashboard-aggregator') &&
party.products.some(
(p) => p.productId === userProduct?.id && p.isAggregator
)
);
}

setIsAsyncFlow(p?.phasesAdditionAllowed.includes('dashboard-async'));
}
: undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const validateConfirmEmail = (

const validateProductRoles = (productRoles: Array<any> | undefined) =>
productRoles?.length === 0 ? requiredError : undefined;

/*
const validateToAddOnAggregates = (toAddOnAggregates: any, isAdminEaOnProdIO: boolean) => {
// Only validate if isAdminEaOnProdIO is true
if (!isAdminEaOnProdIO) {
Expand All @@ -44,11 +44,12 @@ const validateToAddOnAggregates = (toAddOnAggregates: any, isAdminEaOnProdIO: bo

return toAddOnAggregates === undefined ? requiredError : undefined;
};

*/
export const validateUserForm = (
values: Partial<PartyUserOnCreation>,
t: (key: string) => string,
isAdminEaOnProdIO: boolean
// TODO enable after groups automation is in place
_isAdminEaOnProdIO: boolean
) => {
const validationResults = {
name: validateName(values.name, values.taxCode, t),
Expand All @@ -57,7 +58,7 @@ export const validateUserForm = (
email: validateEmail(values.email, t),
confirmEmail: validateConfirmEmail(values.confirmEmail, values.email, t),
productRoles: validateProductRoles(values.productRoles),
toAddOnAggregates: validateToAddOnAggregates(values.toAddOnAggregates, isAdminEaOnProdIO),
// toAddOnAggregates: validateToAddOnAggregates(values.toAddOnAggregates, isAdminEaOnProdIO),
};

// Filter out undefined values (no errors)
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2302,10 +2302,10 @@
write-yaml-file "^4.1.3"
yargs "^15.0.1"

"@pagopa/selfcare-common-frontend@^1.34.71":
version "1.34.71"
resolved "https://registry.yarnpkg.com/@pagopa/selfcare-common-frontend/-/selfcare-common-frontend-1.34.71.tgz#c563eb43251d987f48d250fb34d2398ac14e7d8d"
integrity sha512-vZ0Yot39xdKDfkMOP4Kpwhth1tGt+zCDAObb1vdV7bv2DpiJ7U+JmnFOZHQ/KQuRo5nbkVzWS2ceQgDEvlSVIw==
"@pagopa/selfcare-common-frontend@^1.34.72":
version "1.34.72"
resolved "https://registry.yarnpkg.com/@pagopa/selfcare-common-frontend/-/selfcare-common-frontend-1.34.72.tgz#4567e62b41ff9334b9e8f7d01d8a0ae37cf17123"
integrity sha512-GeLg0uicpNjZPb/eJ1M3ZD4DjeHZky02xTJnT6b+xRJnsErqq5ic/xhZaZI+LEBNCm0FmMAQedX4GG0SOVUNVg==
dependencies:
"@emotion/react" "^11.11.1"
"@emotion/styled" "^11.11.0"
Expand Down
Loading