Skip to content

Commit

Permalink
Issue feat: PS-3578 suggest Username with combination of firstname+la…
Browse files Browse the repository at this point in the history
…stname
  • Loading branch information
AkshataKatwal16 committed Jan 23, 2025
1 parent e323b5f commit 7857ae7
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/components/AddLeanerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
}) => {
const [schema, setSchema] = React.useState<any>();
const [uiSchema, setUiSchema] = React.useState<any>();
const [customFormData, setCustomFormData] = React.useState<any>(formData);

const [reloadProfile, setReloadProfile] = React.useState(false);
const [openModal, setOpenModal] = React.useState(false);
const [learnerFormData, setLearnerFormData] = React.useState<any>();
Expand Down Expand Up @@ -305,9 +307,22 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
}
};


const handleChange = (event: IChangeEvent<any>) => {
console.log('Form data changed:', event.formData);
if (!isEditModal) {
const { firstName, lastName } = event.formData;

if (firstName && lastName) {
event.formData.username = firstName + lastName;
} else {
event.formData.username = "";
}
setCustomFormData({ ...event.formData });

}

};


const handleError = (errors: any) => {
console.log('Form errors:', errors);
Expand Down Expand Up @@ -355,7 +370,7 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
widgets={{}}
showErrorList={true}
customFields={customFields}
formData={formData ?? undefined}
formData={customFormData ?? undefined}
>
<FormButtons
formData={formData ?? learnerFormData}
Expand Down

0 comments on commit 7857ae7

Please sign in to comment.