Commit 1d1620d0 authored by janithgamage1.ed's avatar janithgamage1.ed

fix : update

Desc : update project
parent ccd28f55
......@@ -11,28 +11,13 @@ const commonFields = {
type: Date,
default: new Date(),
},
};
const taskItemSchema = new mongoose.Schema({
title: String,
description: String,
howToDo: String,
referenceImage: String,
referenceVideo: String,
// Additional fields for task items
});
const tutorialSchema = new mongoose.Schema({
tutorialCode: String,
tutorialTitle: String,
tutorialDescription: String,
tutorialImage: String,
taskItems: [taskItemSchema], // Embed task items as subdocuments
// Additional fields for tutorial content
});
const curriculumSchema = new mongoose.Schema({
curriculumCode: String,
};
const curriculumSchema = new mongoose.Schema({
curriculumCode: {
type: String,
unique: true, // Ensures unique values for curriculumCode
},
curriculumLevel: String,
curriculumTitle: String,
curriculumDescription: String,
......
......@@ -27,7 +27,7 @@ export interface curriculumProps {
curriculumTitle: String;
curriculumDescription: String;
curriculumImage: String;
tutorials: tutorialItemProps[];
tutorials: string[];
status: Number;
createdBy: String;
updatedBy: String;
......
......@@ -8,7 +8,9 @@ import {
DialogTitle,
Divider,
Grid,
InputLabel,
Stack,
TextField,
Tooltip
} from '@mui/material';
// import { useTheme } from '@mui/material/styles';
......@@ -35,6 +37,12 @@ const getInitialValues = (curriculum: FormikValues | null) => {
const newCurriculum = {
_id: undefined,
curriculumCode: "",
curriculumLevel: "",
curriculumTitle: "",
curriculumDescription: "",
curriculumImage: "",
tutorials: [''],
}
if (curriculum) {
......@@ -54,7 +62,7 @@ export interface Props {
curriculumTitle: String;
curriculumDescription: String;
curriculumImage: String;
tutorials: tutorialItemProps[];
tutorials: string[];
status: Number;
createdBy: String;
updatedBy: String;
......@@ -64,29 +72,6 @@ export interface Props {
onCancel: () => void;
}
export interface tutorialItemProps {
_id: number | string | undefined;
tutorialCode: String;
tutorialTitle: String;
tutorialDescription: String;
tutorialImage: String;
status: Number;
createdBy: String;
updatedBy: String;
createdAt: Date;
updatedAt: Date;
taskItems: taskItemProps[]
}
export interface taskItemProps {
_id: number | string | undefined;
title: String;
description: String;
howToDo: String;
referenceImage: String;
referenceVideo: String;
}
const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
// const theme = useTheme();
......@@ -121,8 +106,8 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
}
});
// const { errors, touched, handleSubmit, isSubmitting, getFieldProps } = formik;
const { handleSubmit, isSubmitting } = formik;
const { errors, touched, handleSubmit, isSubmitting, getFieldProps } = formik;
// const { handleSubmit, isSubmitting } = formik;
return (
<>
......@@ -135,6 +120,73 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
<Grid container spacing={3}>
<Grid item xs={12} md={12}>
<Grid container spacing={3}>
<Grid item xs={4}>
<Stack spacing={1.25}>
<InputLabel htmlFor="curriculumCode">Curriculum Code</InputLabel>
<TextField
fullWidth
id="curriculumCode"
placeholder="Enter Curriculum Code"
{...getFieldProps('curriculumCode')}
error={Boolean(touched.curriculumCode && errors.curriculumCode)}
helperText={touched.curriculumCode && errors.curriculumCode}
/>
</Stack>
</Grid>
<Grid item xs={4}>
<Stack spacing={1.25}>
<InputLabel htmlFor="curriculumLevel">Curriculum Level</InputLabel>
<TextField
fullWidth
id="curriculumLevel"
placeholder="Enter Curriculum Level"
{...getFieldProps('curriculumLevel')}
error={Boolean(touched.curriculumLevel && errors.curriculumLevel)}
helperText={touched.curriculumLevel && errors.curriculumLevel}
/>
</Stack>
</Grid>
<Grid item xs={4}>
<Stack spacing={1.25}>
<InputLabel htmlFor="curriculumTitle">Curriculum Title</InputLabel>
<TextField
fullWidth
id="curriculumTitle"
placeholder="Enter Curriculum Title"
{...getFieldProps('curriculumTitle')}
error={Boolean(touched.curriculumTitle && errors.curriculumTitle)}
helperText={touched.curriculumTitle && errors.curriculumTitle}
/>
</Stack>
</Grid>
<Grid item xs={12}>
<Stack spacing={1.25}>
<InputLabel htmlFor="curriculumImage">Curriculum Image</InputLabel>
<TextField
fullWidth
id="curriculumImage"
placeholder="Enter Curriculum Image"
{...getFieldProps('curriculumImage')}
error={Boolean(touched.curriculumImage && errors.curriculumImage)}
helperText={touched.curriculumImage && errors.curriculumImage}
/>
</Stack>
</Grid>
<Grid item xs={12}>
<Stack spacing={1.25}>
<InputLabel htmlFor="curriculumDescription">Curriculum Description</InputLabel>
<TextField
multiline
rows={2}
fullWidth
id="curriculumDescription"
placeholder="Enter Curriculum Description"
{...getFieldProps('curriculumDescription')}
error={Boolean(touched.curriculumDescription && errors.curriculumDescription)}
helperText={touched.curriculumDescription && errors.curriculumDescription}
/>
</Stack>
</Grid>
</Grid>
</Grid>
</Grid>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment