From 325e5fd2bce0f6c47adf6d60ca32e0930f718acf Mon Sep 17 00:00:00 2001 From: Arturo Buono Date: Thu, 29 Feb 2024 10:30:09 +0100 Subject: [PATCH] feat(cr-fe-onBoarding): updates 20240229 --- .../src/components/Footer/footer.tsx | 1 + fe-piattaforma/src/components/Form/form.tsx | 6 +- .../src/components/Header/header.tsx | 10 ++-- .../SwitchProfileModal/switchProfileModal.tsx | 8 +-- .../Entities/modals/manageProfile.tsx | 4 +- fe-piattaforma/src/pages/common/Auth/auth.tsx | 2 +- .../pages/common/UserProfile/userProfile.tsx | 4 +- ...rmOnboarding.tsx => formRegistrazione.tsx} | 31 ++++++----- .../{onboarding.scss => registrazione.scss} | 4 +- .../{onboarding.tsx => registrazione.tsx} | 55 +++++-------------- .../src/pages/facilitator/Survey/survey.tsx | 4 +- fe-piattaforma/src/pages/playground.tsx | 29 +++++----- fe-piattaforma/src/routes/index.tsx | 10 +++- fe-piattaforma/src/routes/routes.tsx | 10 ++-- 14 files changed, 81 insertions(+), 97 deletions(-) rename fe-piattaforma/src/pages/facilitator/Onboarding/{formOnboarding.tsx => formRegistrazione.tsx} (90%) rename fe-piattaforma/src/pages/facilitator/Onboarding/{onboarding.scss => registrazione.scss} (89%) rename fe-piattaforma/src/pages/facilitator/Onboarding/{onboarding.tsx => registrazione.tsx} (75%) diff --git a/fe-piattaforma/src/components/Footer/footer.tsx b/fe-piattaforma/src/components/Footer/footer.tsx index 1a8e23d30..7aa240e4c 100644 --- a/fe-piattaforma/src/components/Footer/footer.tsx +++ b/fe-piattaforma/src/components/Footer/footer.tsx @@ -141,6 +141,7 @@ const Footer: React.FC = () => {
Informativa privacy e cookie diff --git a/fe-piattaforma/src/components/Form/form.tsx b/fe-piattaforma/src/components/Form/form.tsx index d3f261742..2006928f6 100644 --- a/fe-piattaforma/src/components/Form/form.tsx +++ b/fe-piattaforma/src/components/Form/form.tsx @@ -12,6 +12,7 @@ interface FormI { showMandatory?: boolean; marginShowMandatory?: boolean; customMargin?: string; + showCampoObbligatorio?: boolean; } const Form = (props: FormI) => { @@ -26,6 +27,7 @@ const Form = (props: FormI) => { showMandatory = true, marginShowMandatory = true, customMargin = '', + showCampoObbligatorio, } = props; return ( @@ -45,7 +47,9 @@ const Form = (props: FormI) => { customMargin ? customMargin : 'mb-5' )} > - {customMandatoryText || '*Campo obbligatorio'} + {customMandatoryText || showCampoObbligatorio + ? '*Campo obbligatorio' + : ''}
)} {React.Children.map(children, (child) => { diff --git a/fe-piattaforma/src/components/Header/header.tsx b/fe-piattaforma/src/components/Header/header.tsx index bf070005d..2e9a2369a 100644 --- a/fe-piattaforma/src/components/Header/header.tsx +++ b/fe-piattaforma/src/components/Header/header.tsx @@ -2,12 +2,12 @@ import React, { memo, useEffect, useState } from 'react'; import { useDispatch } from 'react-redux'; import { useAppSelector } from '../../redux/hooks'; import { - selectUserNotificationToRead, - selectUser, - UserStateI, selectProfile, - UserProfileI, + selectUser, selectUserChatToRead, + selectUserNotificationToRead, + UserProfileI, + UserStateI, } from '../../redux/features/user/userSlice'; import { selectDevice } from '../../redux/features/app/appSlice'; import HeaderMobile from './view/headerMobile'; @@ -150,7 +150,7 @@ const Header: React.FC = (props) => { ) : ( )} - + {hasUserPermission(['btn.chat']) ? : null} ); diff --git a/fe-piattaforma/src/components/Modals/SwitchProfileModal/switchProfileModal.tsx b/fe-piattaforma/src/components/Modals/SwitchProfileModal/switchProfileModal.tsx index 36dc98152..4ca35b3c1 100644 --- a/fe-piattaforma/src/components/Modals/SwitchProfileModal/switchProfileModal.tsx +++ b/fe-piattaforma/src/components/Modals/SwitchProfileModal/switchProfileModal.tsx @@ -21,12 +21,12 @@ const id = 'switchProfileModal'; interface SwitchProfileModalI { isRoleManaging?: boolean; - isOnboarding?: boolean; + isRegistrazione?: boolean; profilePicture?: string; } const SwitchProfileModal: React.FC = ({ - isOnboarding = false, + isRegistrazione = false, profilePicture = '', }) => { const dispatch = useDispatch(); @@ -120,7 +120,7 @@ const SwitchProfileModal: React.FC = ({ disabled: !Object.keys(profileSelected)?.length, }} secondaryCTA={ - isOnboarding + isRegistrazione ? undefined : { label: 'Annulla', @@ -131,7 +131,7 @@ const SwitchProfileModal: React.FC = ({ noSpaceAfterTitle centerButtons isRoleManaging - closableKey={isOnboarding ? 'unclosable' : undefined} + closableKey={isRegistrazione ? 'unclosable' : undefined} >
{ onClick: () => dispatch(closeModal()), }} > - setNewFormValues(FormHelper.getFormValues(newForm)) } diff --git a/fe-piattaforma/src/pages/common/Auth/auth.tsx b/fe-piattaforma/src/pages/common/Auth/auth.tsx index ab1f2f2a1..dfe8f1b14 100644 --- a/fe-piattaforma/src/pages/common/Auth/auth.tsx +++ b/fe-piattaforma/src/pages/common/Auth/auth.tsx @@ -47,7 +47,7 @@ const Auth: React.FC = ({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore if (validUser) { - navigate('/onboarding'); + navigate('/registrazione'); } else { console.log('manage context error', validUser); navigate( diff --git a/fe-piattaforma/src/pages/common/UserProfile/userProfile.tsx b/fe-piattaforma/src/pages/common/UserProfile/userProfile.tsx index b60f336a0..169e3e7f1 100644 --- a/fe-piattaforma/src/pages/common/UserProfile/userProfile.tsx +++ b/fe-piattaforma/src/pages/common/UserProfile/userProfile.tsx @@ -3,7 +3,6 @@ import { useDispatch } from 'react-redux'; import { useNavigate } from 'react-router-dom'; import clsx from 'clsx'; import DetailLayout from '../../../components/DetailLayout/detailLayout'; -import FormOnboarding from '../../facilitator/Onboarding/formOnboarding'; import { ButtonInButtonsBar } from '../../../components/ButtonsBar/buttonsBar'; import { openModal } from '../../../redux/features/modal/modalSlice'; import { @@ -20,6 +19,7 @@ import { CardStatusAction } from '../../../components'; import { getSessionValues } from '../../../utils/sessionHelper'; import { GetUserDetails } from '../../../redux/features/administrativeArea/user/userThunk'; import { selectUsers } from '../../../redux/features/administrativeArea/administrativeAreaSlice'; +import FormRegistrazione from '../../facilitator/Registrazione/formRegistrazione'; interface RoleI { id: string; @@ -109,7 +109,7 @@ const UserProfile = () => { formButtons={correctButtons} profilePicture={user?.immagineProfilo} > - + {userRoleList?.length ? (
diff --git a/fe-piattaforma/src/pages/facilitator/Onboarding/formOnboarding.tsx b/fe-piattaforma/src/pages/facilitator/Onboarding/formRegistrazione.tsx similarity index 90% rename from fe-piattaforma/src/pages/facilitator/Onboarding/formOnboarding.tsx rename to fe-piattaforma/src/pages/facilitator/Onboarding/formRegistrazione.tsx index 0963c43d0..51e77e28a 100644 --- a/fe-piattaforma/src/pages/facilitator/Onboarding/formOnboarding.tsx +++ b/fe-piattaforma/src/pages/facilitator/Onboarding/formRegistrazione.tsx @@ -16,7 +16,7 @@ import { Form, Input } from '../../../components'; import { selectUser } from '../../../redux/features/user/userSlice'; import { contractTypes } from '../../administrator/AdministrativeArea/Entities/utils'; -export interface FormOnboardingI { +export interface FormRegistrazioneI { onInputChange?: withFormHandlerProps['onInputChange']; onSubmitForm?: () => void; optionsSelect?: OptionType[]; @@ -27,8 +27,9 @@ export interface FormOnboardingI { isProfile?: boolean; } -interface FormProfileI extends withFormHandlerProps, FormOnboardingI {} -const FormOnboarding: React.FC = (props) => { +interface FormProfileI extends withFormHandlerProps, FormRegistrazioneI {} + +const FormRegistrazione: React.FC = (props) => { const { setFormValues = () => ({}), updateFormField = () => ({}), @@ -101,28 +102,26 @@ const FormOnboarding: React.FC = (props) => { ); }, [showTipoContratto]); - /* const bootClass = 'justify-content-between px-0 px-lg-5 mx-2'; */ - return (
- + @@ -159,7 +158,6 @@ const FormOnboarding: React.FC = (props) => { {...form?.email} required label='Email' - //placeholder='Inserisci email' col='col-12 col-md-6' onInputChange={onInputChange} /> @@ -167,7 +165,6 @@ const FormOnboarding: React.FC = (props) => { {...form?.telefono} required label='Telefono' - //placeholder='Inserisci telefono' col='col-12 col-md-6' onInputChange={onInputChange} /> @@ -176,7 +173,6 @@ const FormOnboarding: React.FC = (props) => { {...form?.bio} required label='Posizione Lavorativa' - //placeholder='Posizione Lavorativa' col='col-12 col-md-6' onInputChange={onInputChange} /> @@ -189,7 +185,6 @@ const FormOnboarding: React.FC = (props) => { {...form?.tipoContratto} label='Tipo di Contratto' col='col-12 col-lg-6' - // placeholder='Tipologia di contratto' onInputChange={onInputChange} /> ) : ( @@ -210,6 +205,14 @@ const FormOnboarding: React.FC = (props) => { )} +
+ *Campo obbligatorio +
); @@ -258,4 +261,4 @@ const form: FormI = newForm([ }), ]); -export default withFormHandler({ form }, FormOnboarding); +export default withFormHandler({ form }, FormRegistrazione); diff --git a/fe-piattaforma/src/pages/facilitator/Onboarding/onboarding.scss b/fe-piattaforma/src/pages/facilitator/Onboarding/registrazione.scss similarity index 89% rename from fe-piattaforma/src/pages/facilitator/Onboarding/onboarding.scss rename to fe-piattaforma/src/pages/facilitator/Onboarding/registrazione.scss index 98e98600f..6528641e9 100644 --- a/fe-piattaforma/src/pages/facilitator/Onboarding/onboarding.scss +++ b/fe-piattaforma/src/pages/facilitator/Onboarding/registrazione.scss @@ -1,4 +1,4 @@ -.onboarding { +.registrazione { &__img-profile { width: 174px; height: 174px; @@ -12,7 +12,7 @@ } &__icon { - left:6px; + left: 6px; top: 6px; } } diff --git a/fe-piattaforma/src/pages/facilitator/Onboarding/onboarding.tsx b/fe-piattaforma/src/pages/facilitator/Onboarding/registrazione.tsx similarity index 75% rename from fe-piattaforma/src/pages/facilitator/Onboarding/onboarding.tsx rename to fe-piattaforma/src/pages/facilitator/Onboarding/registrazione.tsx index 0f5a49f0e..80b3cbe76 100644 --- a/fe-piattaforma/src/pages/facilitator/Onboarding/onboarding.tsx +++ b/fe-piattaforma/src/pages/facilitator/Onboarding/registrazione.tsx @@ -7,7 +7,6 @@ import { hideBreadCrumb, selectDevice, } from '../../../redux/features/app/appSlice'; -import Profile from '/public/assets/img/change-profile.png'; import { CommonFields, FormI, @@ -30,31 +29,28 @@ import { SelectUserRole, } from '../../../redux/features/user/userThunk'; import { openModal } from '../../../redux/features/modal/modalSlice'; -import FormOnboarding from './formOnboarding'; import { defaultRedirectUrl } from '../../../routes'; -import '../../../../src/pages/facilitator/Onboarding/onboarding.scss'; +import './registrazione.scss'; +import FormRegistrazione from './formRegistrazione'; interface ProfilePicI { image?: boolean; } -interface OnboardingI extends ProfilePicI, withFormHandlerProps {} +interface RegistrazioneI extends ProfilePicI, withFormHandlerProps {} -const Onboarding: React.FC = (props) => { +const Registrazione: React.FC = (props) => { const dispatch = useDispatch(); const navigate = useNavigate(); const device = useAppSelector(selectDevice); const user = useAppSelector(selectUser); - const image = user?.immagineProfilo || Profile; const [isValidForm, setIsValidForm] = useState(false); - const { - form, - getFormValues = () => ({}), - onInputChange = () => ({}), - updateForm = () => ({}), - } = props; + const { getFormValues = () => ({}), updateForm = () => ({}) } = props; + const [ruolo, setRuolo] = useState(''); useEffect(() => { + const userRuolo: any = user; + setRuolo(userRuolo.ruoli[0].nomeRuolo.toLowerCase() as string); if (user?.integrazione) { selectUserRole(); dispatch(hideBreadCrumb()); @@ -127,10 +123,10 @@ const Onboarding: React.FC = (props) => {

- Per completare il tuo profilo da facilitatore abbiamo bisogno di - alcuni tuoi dati.
Completa i campi obbligatori per procedere. + Per completare il tuo profilo da {ruolo} abbiamo bisogno di alcuni + tuoi dati.
Completa i campi obbligatori per procedere.

- setIsValidForm(isValid)} /> @@ -142,7 +138,8 @@ const Onboarding: React.FC = (props) => { device.mediaIsPhone && 'flex-column align-items-center ' )} > -
+ {/* eslint-disable-next-line react/no-unescaped-entities */} + Leggi l'informativa sul trattamento dei dati personali
- {/*
-
- Leggi l informativa sul trattamento dei dati personali - -
- {/*

- *Campo obbligatorio -

*/} - {/*
*/}
); @@ -229,4 +202,4 @@ const form: FormI = newForm([ }), ]); -export default withFormHandler({ form }, Onboarding); +export default withFormHandler({ form }, Registrazione); diff --git a/fe-piattaforma/src/pages/facilitator/Survey/survey.tsx b/fe-piattaforma/src/pages/facilitator/Survey/survey.tsx index 2435b9134..41e3f4072 100644 --- a/fe-piattaforma/src/pages/facilitator/Survey/survey.tsx +++ b/fe-piattaforma/src/pages/facilitator/Survey/survey.tsx @@ -34,8 +34,8 @@ const arrayBreadcrumb = [ url: '/', }, { - label: 'Onboarding', - url: '/onboarding', + label: 'Registrazione', + url: '/registrazione', }, { label: 'Survey', diff --git a/fe-piattaforma/src/pages/playground.tsx b/fe-piattaforma/src/pages/playground.tsx index be6b7c06d..73b68f7fe 100644 --- a/fe-piattaforma/src/pages/playground.tsx +++ b/fe-piattaforma/src/pages/playground.tsx @@ -5,16 +5,16 @@ import { useDispatch } from 'react-redux'; import { useTranslation } from 'react-i18next'; import { dispatchNotify } from '../utils/notifictionHelper'; import { + DropdownFilter, + Footer, Form, InfoPanel, Input, - Rating, - Stepper, - DropdownFilter, - ProgressBar, PrefixPhone, + ProgressBar, + Rating, StatusChip, - Footer, + Stepper, } from '../components'; import CheckboxGroup from '../components/Form/checkboxGroup'; import withFormHandler, { withFormHandlerProps } from '../hoc/withFormHandler'; @@ -39,6 +39,13 @@ import PillDropDown from '../components/PillDropDown/pillDropDown'; // import SectionDetail from '../components/DocumentDetail/sectionDetail'; import Slider from '../components/General/Slider/Slider'; import TextEditor from '../components/General/TextEditor/TextEditor'; +// const DocumentDetailMock = [DocumentCardDetailMock]; +import UserAvatar from '../components/Avatar/UserAvatar/UserAvatar'; +import { closeModal, openModal } from '../redux/features/modal/modalSlice'; +import GenericModal from '../components/Modals/GenericModal/genericModal'; +import { getAnagraphicID } from '../redux/features/anagraphic/anagraphicSlice'; +import ManageProfilePic from '../pages/administrator/AdministrativeArea/Entities/modals/manageProfilePic'; +import Registrazione from './facilitator/Registrazione/registrazione'; export const DocumentCardDetailMock = { typology: 'TIPOLOGIA — ', @@ -49,14 +56,6 @@ export const DocumentCardDetailMock = { 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin nibh nibh, tincidunt non ultricies viverra, malesuada et massa. Mauris quis tortor magna. In suscipit nulla vitae ex efficitur, a cursus mi aliquam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin nibh nibh, tincidunt non ultricies viverra, malesuada et massa.', }; -// const DocumentDetailMock = [DocumentCardDetailMock]; -import UserAvatar from '../components/Avatar/UserAvatar/UserAvatar'; -import { closeModal, openModal } from '../redux/features/modal/modalSlice'; -import GenericModal from '../components/Modals/GenericModal/genericModal'; -import { getAnagraphicID } from '../redux/features/anagraphic/anagraphicSlice'; -import ManageProfilePic from '../pages/administrator/AdministrativeArea/Entities/modals/manageProfilePic'; -import Onboarding from './facilitator/Onboarding/onboarding'; - const Playground: React.FC = (props) => { const { t } = useTranslation(); const dispatch = useDispatch(); @@ -464,7 +463,7 @@ const Playground: React.FC = (props) => {
- +
@@ -492,7 +491,7 @@ const Playground: React.FC = (props) => {
- +
diff --git a/fe-piattaforma/src/routes/index.tsx b/fe-piattaforma/src/routes/index.tsx index 35e7eb09a..0d1d38ce7 100644 --- a/fe-piattaforma/src/routes/index.tsx +++ b/fe-piattaforma/src/routes/index.tsx @@ -40,8 +40,8 @@ const RoleManagementDetails = lazy( '../pages/common/RoleManagement/RoleManagementDetails/roleManagementDetails' ) ); -const Onboarding = lazy( - () => import('../pages/facilitator/Onboarding/onboarding') +const Registrazione = lazy( + () => import('../pages/facilitator/Registrazione/registrazione') ); const PrintSurvey = lazy( () => @@ -342,8 +342,12 @@ const AppRoutes: React.FC = () => { } /> }> {/* Public Paths */} - } /> + } /> } /> + } + /> }> } /> diff --git a/fe-piattaforma/src/routes/routes.tsx b/fe-piattaforma/src/routes/routes.tsx index 317bd4b6a..daaa91144 100644 --- a/fe-piattaforma/src/routes/routes.tsx +++ b/fe-piattaforma/src/routes/routes.tsx @@ -7,16 +7,15 @@ import React from 'react'; import { BreadcrumbI } from '../components/Breadcrumb/breadCrumb'; import { AdministrativeArea, + Auth, Documents, HomeFacilitator, Playground, Survey, - Auth, } from '../pages'; import CitizensArea from '../pages/administrator/CitizensArea/citizensArea'; import RoleManagement from '../pages/common/RoleManagement/roleManagement'; import RoleManagementDetails from '../pages/common/RoleManagement/RoleManagementDetails/roleManagementDetails'; -import Onboarding from '../pages/facilitator/Onboarding/formOnboarding'; import { RolePermissionI } from '../redux/features/roles/rolesSlice'; import PrintSurvey from '../pages/administrator/AdministrativeArea/Entities/Surveys/printSurvey/printSurvey'; import Programs from '../pages/administrator/AdministrativeArea/Entities/Programs/programs'; @@ -37,6 +36,7 @@ import Citizens from '../pages/administrator/CitizensArea/Entities/Citizens/citi import CitizensDetail from '../pages/administrator/CitizensArea/Entities/Citizens/citizensDetail'; import Notifications from '../pages/common/NotificationsPage/notifications'; import UserProfile from '../pages/common/UserProfile/userProfile'; +import Registrazione from '../pages/facilitator/Registrazione/registrazione'; export enum layoutEnum { fullLayout = 'FULL_LAYOUT', @@ -172,9 +172,9 @@ const routes = [ }), newRoute({ scope: 'app', - path: '/onboarding', - title: `Onboarding`, - element: , + path: '/registrazione', + title: `Registrazione`, + element: , visibleTo: [], layout: layoutEnum.mainLayout, isHeaderFull: false,