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

fix : update

Desc : update project
parent ccd28f55
...@@ -13,26 +13,11 @@ const commonFields = { ...@@ -13,26 +13,11 @@ const commonFields = {
}, },
}; };
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({ const curriculumSchema = new mongoose.Schema({
curriculumCode: String, curriculumCode: {
type: String,
unique: true, // Ensures unique values for curriculumCode
},
curriculumLevel: String, curriculumLevel: String,
curriculumTitle: String, curriculumTitle: String,
curriculumDescription: String, curriculumDescription: String,
......
...@@ -27,7 +27,7 @@ export interface curriculumProps { ...@@ -27,7 +27,7 @@ export interface curriculumProps {
curriculumTitle: String; curriculumTitle: String;
curriculumDescription: String; curriculumDescription: String;
curriculumImage: String; curriculumImage: String;
tutorials: tutorialItemProps[]; tutorials: string[];
status: Number; status: Number;
createdBy: String; createdBy: String;
updatedBy: String; updatedBy: String;
......
...@@ -8,7 +8,9 @@ import { ...@@ -8,7 +8,9 @@ import {
DialogTitle, DialogTitle,
Divider, Divider,
Grid, Grid,
InputLabel,
Stack, Stack,
TextField,
Tooltip Tooltip
} from '@mui/material'; } from '@mui/material';
// import { useTheme } from '@mui/material/styles'; // import { useTheme } from '@mui/material/styles';
...@@ -35,6 +37,12 @@ const getInitialValues = (curriculum: FormikValues | null) => { ...@@ -35,6 +37,12 @@ const getInitialValues = (curriculum: FormikValues | null) => {
const newCurriculum = { const newCurriculum = {
_id: undefined, _id: undefined,
curriculumCode: "",
curriculumLevel: "",
curriculumTitle: "",
curriculumDescription: "",
curriculumImage: "",
tutorials: [''],
} }
if (curriculum) { if (curriculum) {
...@@ -54,7 +62,7 @@ export interface Props { ...@@ -54,7 +62,7 @@ export interface Props {
curriculumTitle: String; curriculumTitle: String;
curriculumDescription: String; curriculumDescription: String;
curriculumImage: String; curriculumImage: String;
tutorials: tutorialItemProps[]; tutorials: string[];
status: Number; status: Number;
createdBy: String; createdBy: String;
updatedBy: String; updatedBy: String;
...@@ -64,29 +72,6 @@ export interface Props { ...@@ -64,29 +72,6 @@ export interface Props {
onCancel: () => void; 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 AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
// const theme = useTheme(); // const theme = useTheme();
...@@ -121,8 +106,8 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => { ...@@ -121,8 +106,8 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
} }
}); });
// const { errors, touched, handleSubmit, isSubmitting, getFieldProps } = formik; const { errors, touched, handleSubmit, isSubmitting, getFieldProps } = formik;
const { handleSubmit, isSubmitting } = formik; // const { handleSubmit, isSubmitting } = formik;
return ( return (
<> <>
...@@ -135,6 +120,73 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => { ...@@ -135,6 +120,73 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
<Grid container spacing={3}> <Grid container spacing={3}>
<Grid item xs={12} md={12}> <Grid item xs={12} md={12}>
<Grid container spacing={3}> <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> </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