Skip to content

Commit

Permalink
Issue #PS-1255 chore: Applied formatting for code
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushikesh-Sonawane99 committed Aug 1, 2024
1 parent 168f94d commit da43169
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 90 deletions.
2 changes: 1 addition & 1 deletion src/components/AddFacilitator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
data: IChangeEvent<any, RJSFSchema, any>,
event: React.FormEvent<any>
) => {
if(!isEditModal){
if (!isEditModal) {
setOpenModal(true);
}
const target = event.target as HTMLFormElement;
Expand Down
158 changes: 79 additions & 79 deletions src/components/AddLeanerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface AddLearnerModalProps {
formData?: object;
isEditModal?: boolean;
userId?: string;
onReload?: (() => void)| undefined;
onReload?: (() => void) | undefined;
}
const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
open,
Expand All @@ -33,7 +33,7 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
formData,
isEditModal = false,
userId,
onReload
onReload,
}) => {
const [schema, setSchema] = React.useState<any>();
const [uiSchema, setUiSchema] = React.useState<any>();
Expand Down Expand Up @@ -174,11 +174,11 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
userData: userData,
customFields: customFields,
};
const response = await editEditUser(userId, object);
const response = await editEditUser(userId, object);
if (response) {
showToastMessage(t('COMMON.LEARNER_UPDATED_SUCCESSFULLY'), 'success');
setReloadProfile(true);
onReload?.();
setReloadProfile(true);
onReload?.();
}
} else {
const response = await createUser(apiBody);
Expand Down Expand Up @@ -215,41 +215,41 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
justifyContent: 'space-between',
}}
>
<>
<Button
variant="outlined"
color="primary"
sx={{
'&.Mui-disabled': {
backgroundColor: theme?.palette?.primary?.main,
},
minWidth: '84px',
height: '2.5rem',
padding: theme.spacing(1),
fontWeight: '500',
width: '48%',
}}
onClick={onClose}
>
{t('COMMON.BACK')}
</Button>
<Button
variant="contained"
color="primary"
sx={{
'&.Mui-disabled': {
backgroundColor: theme?.palette?.primary?.main,
},
minWidth: '84px',
height: '2.5rem',
padding: theme.spacing(1),
fontWeight: '500',
width: '48%',
}}
onClick={secondaryActionHandler}
>
{t('COMMON.SUBMIT')}
</Button>
<>
<Button
variant="outlined"
color="primary"
sx={{
'&.Mui-disabled': {
backgroundColor: theme?.palette?.primary?.main,
},
minWidth: '84px',
height: '2.5rem',
padding: theme.spacing(1),
fontWeight: '500',
width: '48%',
}}
onClick={onClose}
>
{t('COMMON.BACK')}
</Button>
<Button
variant="contained"
color="primary"
sx={{
'&.Mui-disabled': {
backgroundColor: theme?.palette?.primary?.main,
},
minWidth: '84px',
height: '2.5rem',
padding: theme.spacing(1),
fontWeight: '500',
width: '48%',
}}
onClick={secondaryActionHandler}
>
{t('COMMON.SUBMIT')}
</Button>
</>
</div>
);
Expand All @@ -272,45 +272,45 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({

return (
<>
<SimpleModal
open={open}
onClose={onClose}
showFooter={false}
modalTitle={t('COMMON.NEW_LEARNER')}
>
{formData
? schema &&
uiSchema && (
<DynamicForm
schema={schema}
uiSchema={uiSchema}
onSubmit={handleSubmit}
onChange={handleChange}
onError={handleError}
widgets={{}}
showErrorList={true}
customFields={customFields}
formData={formData}
>
{/* <CustomSubmitButton onClose={primaryActionHandler} /> */}
</DynamicForm>
)
: schema &&
uiSchema && (
<DynamicForm
schema={schema}
uiSchema={uiSchema}
onSubmit={handleSubmit}
onChange={handleChange}
onError={handleError}
widgets={{}}
showErrorList={true}
customFields={customFields}
>
{/* <CustomSubmitButton onClose={primaryActionHandler} /> */}
</DynamicForm>
)}
</SimpleModal>
<SimpleModal
open={open}
onClose={onClose}
showFooter={false}
modalTitle={t('COMMON.NEW_LEARNER')}
>
{formData
? schema &&
uiSchema && (
<DynamicForm
schema={schema}
uiSchema={uiSchema}
onSubmit={handleSubmit}
onChange={handleChange}
onError={handleError}
widgets={{}}
showErrorList={true}
customFields={customFields}
formData={formData}
>
{/* <CustomSubmitButton onClose={primaryActionHandler} /> */}
</DynamicForm>
)
: schema &&
uiSchema && (
<DynamicForm
schema={schema}
uiSchema={uiSchema}
onSubmit={handleSubmit}
onChange={handleChange}
onError={handleError}
widgets={{}}
showErrorList={true}
customFields={customFields}
>
{/* <CustomSubmitButton onClose={primaryActionHandler} /> */}
</DynamicForm>
)}
</SimpleModal>
</>
);
};
Expand Down
17 changes: 7 additions & 10 deletions src/pages/learner/[userId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const LearnerProfile: React.FC = () => {
const [reload, setReload] = React.useState(false);

const handleReload = () => {
setReload(prev => !prev);
setReload((prev) => !prev);
};

const StyledMenu = styled((props: MenuProps) => (
Expand Down Expand Up @@ -227,20 +227,17 @@ const LearnerProfile: React.FC = () => {
if (item?.isMultiSelect) {
if (userData[item.name] && item?.maxSelections > 1) {
initialFormData[item.name] = [userData[item.name]];
}
else if (item?.type === "checkbox") {
initialFormData[item.name]= String(userData[item.name]).split(",");
}
else {
} else if (item?.type === 'checkbox') {
initialFormData[item.name] = String(userData[item.name]).split(',');
} else {
initialFormData[item.name] = userData[item.name];
}
} else if (item?.type === "numeric") {
} else if (item?.type === 'numeric') {
console.log(item?.name);
initialFormData[item.name] = Number(userData[item.name]);
} else if (item?.type === "text" && userData[item.name]) {
} else if (item?.type === 'text' && userData[item.name]) {
initialFormData[item.name] = String(userData[item.name]);
}
else {
} else {
// console.log(item.name);
if (userData[item.name]) {
initialFormData[item.name] = userData[item.name];
Expand Down

0 comments on commit da43169

Please sign in to comment.