Commit dec84279 authored by janithgamage1.ed's avatar janithgamage1.ed

fix: update

Desc : update project
parent 5717066a
export interface StatusType {
id: number
code: string
description: string
}
// ==============================|| DATA - Status ||============================== //
const status: readonly StatusType[] = [
{ id: 1, code: "Active", description: "Active" },
{ id: 2, code: "New", description: "New" },
{ id: 3, code: "Pending", description: "Pending" },
{ id: 4, code: "Hold", description: "Hold" },
{ id: 5, code: "Rejected", description: "Rejected" },
];
export default status;
...@@ -18,11 +18,12 @@ import { ...@@ -18,11 +18,12 @@ import {
// project import // project import
import { curriculums } from 'data/curriculums';
import usePagination from 'hooks/usePagination'; import usePagination from 'hooks/usePagination';
import CurriculumCard from 'sections/learning-management/learning-curriculums/CurriculumCard'; import CurriculumCard from 'sections/learning-management/learning-curriculums/CurriculumCard';
import EmptyCurriculumCard from 'sections/learning-management/learning-curriculums/skeleton/EmptyCurriculumCard'; import EmptyCurriculumCard from 'sections/learning-management/learning-curriculums/skeleton/EmptyCurriculumCard';
import { curriculumType } from 'types/curriculum';
import { GlobalFilter } from 'utils/react-table'; import { GlobalFilter } from 'utils/react-table';
import { dataProps } from './types/types';
// types // types
...@@ -37,182 +38,18 @@ const allColumns = [ ...@@ -37,182 +38,18 @@ const allColumns = [
}, },
{ {
id: 2, id: 2,
header: 'Code' header: 'Title'
},
{
id: 3,
header: 'Name'
},
{
id: 4,
header: 'Level'
},
{
id: 5,
header: 'Status'
} }
]; ];
const List = () => { const List = () => {
const data: dataProps[] = [ const [data, setData] = useState<curriculumType[]>([])
{
"_id": "1",
"curriculumCode": "01",
"curriculumLevel": 1,
"curriculumDescription": "This curriculum teaches basic sign language skills to help beginners communicate effectively using sign language.",
"curriculumName": "Learn Basic Sign Language Skills",
"curriculumImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorials": [
{
"_id": "1",
"tutorialCode": "01",
"tutorialTitle": "Numbers and Counting in Sign Language",
"tutorialDescription": "In this tutorial, you'll discover how to express numbers visually using simple hand gestures. Each number has a unique sign that involves specific finger placements and hand movements. We'll break down each number step by step, providing you with clear instructions, images, and videos to help you learn effectively.",
"tutorialImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"status": 1,
"createdAt": new Date("2023-08-30T12:00:00Z"),
"taskItems": [
{
"_id": "1",
"title": "Learn Number One",
"description": "Learn how to sign the number one in sign language.",
"howToDo": "- Extend your index finger straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_one.jpg",
"referenceVideo": "https://example.com/number_one_video.mp4"
},
{
"_id": "2",
"title": "Learn Number Two",
"description": "Learn how to sign the number two in sign language.",
"howToDo": "- Extend your index and middle fingers straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_two.jpg",
"referenceVideo": "https://example.com/number_two_video.mp4"
},
{
"_id": "3",
"title": "Learn Number Three",
"description": "Learn how to sign the number three in sign language.",
"howToDo": "- Extend your index, middle, and ring fingers straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_three.jpg",
"referenceVideo": "https://example.com/number_three_video.mp4"
},
{
"_id": "4",
"title": "Learn Number Four",
"description": "Learn how to sign the number four in sign language.",
"howToDo": "- Extend your thumb, index, middle, and ring fingers straight up.\n- Keep your pinky finger folded.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_four.jpg",
"referenceVideo": "https://example.com/number_four_video.mp4"
},
{
"_id": "5",
"title": "Learn Number Five",
"description": "Learn how to sign the number five in sign language.",
"howToDo": "- Extend all your fingers straight up.\n- Keep your thumb resting on the side of your palm.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_five.jpg",
"referenceVideo": "https://example.com/number_five_video.mp4"
},
{
"_id": "6",
"title": "Learn Number Six",
"description": "Learn how to sign the number six in sign language.",
"howToDo": "- Extend your thumb and pinky finger straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_six.jpg",
"referenceVideo": "https://example.com/number_six_video.mp4"
},
{
"_id": "7",
"title": "Learn Number Seven",
"description": "Learn how to sign the number seven in sign language.",
"howToDo": "- Extend your index, middle, and ring fingers straight up.\n- Keep your thumb, pinky, and pinky finger folded.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_seven.jpg",
"referenceVideo": "https://example.com/number_seven_video.mp4"
},
{
"_id": "8",
"title": "Learn Number Eight",
"description": "Learn how to sign the number eight in sign language.",
"howToDo": "- Extend all your fingers straight up.\n- Cross your index and middle fingers over your ring and pinky fingers.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_eight.jpg",
"referenceVideo": "https://example.com/number_eight_video.mp4"
},
{
"_id": "9",
"title": "Learn Number Nine",
"description": "Learn how to sign the number nine in sign language.",
"howToDo": "- Extend your thumb and all your fingers straight up.\n- Keep your pinky finger folded.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_nine.jpg",
"referenceVideo": "https://example.com/number_nine_video.mp4"
},
{
"_id": "10",
"title": "Learn Number Ten",
"description": "Learn how to sign the number ten in sign language.",
"howToDo": "- Extend your thumb, index, and middle fingers straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_ten.jpg",
"referenceVideo": "https://example.com/number_ten_video.mp4"
}
]
},
{
"_id": "2",
"tutorialCode": "02",
"tutorialTitle": "Everyday Vocabulary in Sign Language",
"tutorialDescription": "Teach signs for everyday objects and activities, such as eat, drink, sleep, book, pen, etc.\nIntroduce signs for common words used in daily life.\nProvide visual demonstrations and interactive exercises for learners to practice using these signs.",
"tutorialImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"status": 1,
"createdAt": new Date("2023-08-30T12:00:00Z"),
"taskItems": []
},
{
"_id": "3",
"tutorialCode": "03",
"tutorialTitle": "Family Signs in Sign Language",
"tutorialDescription": "Teach signs for family members, such as mother, father, sister, brother, etc.\nIntroduce signs for common family-related words, such as family, love, and home.\nProvide visual demonstrations and practice exercises for learners to practice these family signs.",
"tutorialImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"status": 1,
"createdAt": new Date("2023-08-30T12:00:00Z"),},
{
"_id": "4",
"tutorialCode": "04",
"tutorialTitle": "Basic Conversational Phrases in Sign Language",
"tutorialDescription": "Teach simple conversational phrases, such as \"What is your name?\" or \"How are you?\"\nIntroduce signs for common question words and phrases.\nProvide visual demonstrations and practice exercises for learners to practice these conversational phrases.",
"tutorialImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"status": 1,
"createdAt": new Date("2023-08-30T12:00:00Z"),}
],
"status": 1,
"createdAt": new Date("2023-08-30T12:00:00Z"),
},
{
"_id": "2",
"curriculumCode": "02",
"curriculumLevel": 2,
"curriculumName": "Learn Intermediate Sign Language Skills",
"curriculumDescription": "This curriculum focuses on building intermediate sign language skills, allowing learners to engage in more complex conversations and interactions using sign language.",
"curriculumImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorials": [],
"status": 1,
"createdAt": new Date("2023-08-30T12:00:00Z"),
},
{
"_id": "3",
"curriculumCode": "03",
"curriculumLevel": 3,
"curriculumName": "Learn Advance Sign Language Skills",
"curriculumDescription": "This curriculum is designed for those who already have a solid foundation in sign language. It covers advanced topics, nuances, and cultural aspects of sign language communication.",
"curriculumImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorials": [],
"status": 1,
"createdAt": new Date("2023-08-30T12:00:00Z"),
}
]
const matchDownSM = useMediaQuery((theme: Theme) => theme.breakpoints.down('sm')); const matchDownSM = useMediaQuery((theme: Theme) => theme.breakpoints.down('sm'));
const [curriculumsData, setCurriculumsData] = useState<curriculumType[]>([]);
const [sortBy, setSortBy] = useState('Default'); const [sortBy, setSortBy] = useState('Default');
const [globalFilter, setGlobalFilter] = useState(''); const [globalFilter, setGlobalFilter] = useState('');
const [curriculumCard, setCurriculumCard] = useState<dataProps[]>([]);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const handleChange = (event: SelectChangeEvent) => { const handleChange = (event: SelectChangeEvent) => {
...@@ -223,27 +60,29 @@ const List = () => { ...@@ -223,27 +60,29 @@ const List = () => {
useEffect(() => { useEffect(() => {
const newData = data.filter((value: any) => { const newData = data.filter((value: any) => {
if (globalFilter) { if (globalFilter) {
return value.curriculumName.toLowerCase().includes(globalFilter.toLowerCase()); return value.curriculumTitle.toLowerCase().includes(globalFilter.toLowerCase());
} else { } else {
return value; return value;
} }
}); });
console.log(newData.length); setCurriculumsData(newData);
}, [globalFilter, data]);
setCurriculumCard(newData);
}, [globalFilter]);
const PER_PAGE = 6; const PER_PAGE = 6;
const count = Math.ceil(curriculumCard.length / PER_PAGE); const count = Math.ceil(curriculumsData.length / PER_PAGE);
const _DATA = usePagination(curriculumCard, PER_PAGE); const _DATA = usePagination(curriculumsData, PER_PAGE);
const handleChangePage = (e: any, p: any) => { const handleChangePage = (e: any, p: any) => {
setPage(p); setPage(p);
_DATA.jump(p); _DATA.jump(p);
}; };
useEffect(() => {
setData(curriculums)
}, [])
return ( return (
<> <>
<Box sx={{ position: 'relative', marginBottom: 3 }}> <Box sx={{ position: 'relative', marginBottom: 3 }}>
...@@ -286,19 +125,14 @@ const List = () => { ...@@ -286,19 +125,14 @@ const List = () => {
</Stack> </Stack>
</Box> </Box>
<Grid container spacing={3}> <Grid container spacing={3}>
{curriculumCard.length > 0 ? ( {curriculumsData.length > 0 ? (
_DATA _DATA
.currentData() .currentData()
.sort(function (a: any, b: any) { .sort(function (a: any, b: any) {
if (sortBy === 'Customer Name') return a.fatherName.localeCompare(b.fatherName); if (sortBy === 'Title') return a.curriculumTitle.localeCompare(b.curriculumTitle);
if (sortBy === 'Email') return a.email.localeCompare(b.email);
if (sortBy === 'Contact') return a.contact.localeCompare(b.contact);
if (sortBy === 'Age') return b.age < a.age ? 1 : -1;
if (sortBy === 'Country') return a.country.localeCompare(b.country);
if (sortBy === 'Status') return a.status.localeCompare(b.status);
return a; return a;
}) })
.map((curriculum: dataProps, index: number) => ( .map((curriculum: curriculumType, index: number) => (
<Slide key={index} direction="up" in={true} timeout={50}> <Slide key={index} direction="up" in={true} timeout={50}>
<Grid item xs={12} sm={6} lg={4}> <Grid item xs={12} sm={6} lg={4}>
<CurriculumCard curriculum={curriculum} /> <CurriculumCard curriculum={curriculum} />
...@@ -306,7 +140,7 @@ const List = () => { ...@@ -306,7 +140,7 @@ const List = () => {
</Slide> </Slide>
)) ))
) : ( ) : (
<EmptyCurriculumCard title={'System have no curriculums yet.'} /> <EmptyCurriculumCard title={'System have no curriculumsData yet.'} />
)} )}
</Grid> </Grid>
<Stack spacing={2} sx={{ p: 2.5 }} alignItems="flex-end"> <Stack spacing={2} sx={{ p: 2.5 }} alignItems="flex-end">
......
...@@ -28,49 +28,13 @@ import { MoreOutlined } from '@ant-design/icons'; ...@@ -28,49 +28,13 @@ import { MoreOutlined } from '@ant-design/icons';
import Avatar from 'components/@extended/Avatar'; import Avatar from 'components/@extended/Avatar';
import curriculumLevels from 'data/curriculumLevels'; import curriculumLevels from 'data/curriculumLevels';
import CurriculumPreview from './CurriculumPreview'; import CurriculumPreview from './CurriculumPreview';
import { curriculumType } from 'types/curriculum';
// types // types
export interface curriculumCardProps {
_id: number | string | undefined;
curriculumCode: string;
curriculumLevel: number;
curriculumName: string;
curriculumDescription: string;
curriculumImage: string;
tutorials?: tutorialItemProps[];
status?: number;
createdBy?: string;
updatedBy?: string;
createdAt?: Date;
updatedAt?: Date;
}
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;
}
// ==============================|| CURRICULUM - CARD ||============================== // // ==============================|| CURRICULUM - CARD ||============================== //
const CurriculumCard = ({ curriculum }: { curriculum: curriculumCardProps }) => { const CurriculumCard = ({ curriculum }: { curriculum: curriculumType }) => {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const handleClickOpen = () => { const handleClickOpen = () => {
...@@ -105,10 +69,10 @@ const CurriculumCard = ({ curriculum }: { curriculum: curriculumCardProps }) => ...@@ -105,10 +69,10 @@ const CurriculumCard = ({ curriculum }: { curriculum: curriculumCardProps }) =>
} }
> >
<ListItemAvatar> <ListItemAvatar>
<Avatar alt={curriculum.curriculumName!} src={curriculum.curriculumImage!} /> <Avatar alt={curriculum.curriculumTitle!} src={curriculum.curriculumImage!} />
</ListItemAvatar> </ListItemAvatar>
<ListItemText <ListItemText
primary={<Typography variant="subtitle1">{curriculum.curriculumName}</Typography>} primary={<Typography variant="subtitle1">{curriculum.curriculumTitle}</Typography>}
secondary={ secondary={
<Typography variant="caption" color="secondary"> <Typography variant="caption" color="secondary">
{curriculumLevels.find(level => level.id === curriculum.curriculumLevel)?.description || ""} {curriculumLevels.find(level => level.id === curriculum.curriculumLevel)?.description || ""}
...@@ -137,7 +101,7 @@ const CurriculumCard = ({ curriculum }: { curriculum: curriculumCardProps }) => ...@@ -137,7 +101,7 @@ const CurriculumCard = ({ curriculum }: { curriculum: curriculumCardProps }) =>
> >
<MenuItem sx={{ a: { textDecoration: 'none', color: 'inherit' } }}> <MenuItem sx={{ a: { textDecoration: 'none', color: 'inherit' } }}>
<PDFDownloadLink <PDFDownloadLink
document={<></>} fileName={`${curriculum.curriculumCode}-${curriculum.curriculumName}.pdf`} document={<></>} fileName={`${curriculum.curriculumCode}-${curriculum.curriculumTitle}.pdf`}
// document={<ListSmallCard customer={customer} />} fileName={`Customer-${customer.fatherName}.pdf`} // document={<ListSmallCard customer={customer} />} fileName={`Customer-${customer.fatherName}.pdf`}
> >
Export PDF Export PDF
......
...@@ -33,50 +33,13 @@ import SimpleBar from 'components/third-party/SimpleBar'; ...@@ -33,50 +33,13 @@ import SimpleBar from 'components/third-party/SimpleBar';
// assets // assets
import { DownloadOutlined, TagOutlined } from '@ant-design/icons'; import { DownloadOutlined, TagOutlined } from '@ant-design/icons';
import curriculumLevels from 'data/curriculumLevels'; import curriculumLevels from 'data/curriculumLevels';
import { curriculumType } from 'types/curriculum';
// types // types
export interface curriculumCardProps {
_id: number | string | undefined;
curriculumCode: string;
curriculumLevel: number;
curriculumName: string;
curriculumDescription: string;
curriculumImage: string;
tutorials?: tutorialItemProps[];
status?: number;
createdBy?: string;
updatedBy?: string;
createdAt?: Date;
updatedAt?: Date;
}
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;
}
// ==============================|| Curriculum - CARD PREVIEW ||============================== // // ==============================|| Curriculum - CARD PREVIEW ||============================== //
export default function CurriculumPreview({ curriculum, open, onClose }: { curriculum: curriculumCardProps; open: boolean; onClose: () => void }) { export default function CurriculumPreview({ curriculum, open, onClose }: { curriculum: curriculumType; open: boolean; onClose: () => void }) {
const theme = useTheme(); const theme = useTheme();
const [expanded, setExpanded] = useState<string | false>('panel0'); const [expanded, setExpanded] = useState<string | false>('panel0');
...@@ -104,7 +67,7 @@ export default function CurriculumPreview({ curriculum, open, onClose }: { curri ...@@ -104,7 +67,7 @@ export default function CurriculumPreview({ curriculum, open, onClose }: { curri
<Stack direction="row" alignItems="center" justifyContent="center" spacing={0}> <Stack direction="row" alignItems="center" justifyContent="center" spacing={0}>
<Tooltip title="Export"> <Tooltip title="Export">
<PDFDownloadLink <PDFDownloadLink
document={<></>} fileName={`${curriculum.curriculumCode}-${curriculum.curriculumName}.pdf`} document={<></>} fileName={`${curriculum.curriculumCode}-${curriculum.curriculumTitle}.pdf`}
// document={<ListCard customer={customer} />} fileName={`Customer-${customer.fatherName}.pdf`} // document={<ListCard customer={customer} />} fileName={`Customer-${customer.fatherName}.pdf`}
> >
<IconButton color="secondary"> <IconButton color="secondary">
...@@ -126,10 +89,10 @@ export default function CurriculumPreview({ curriculum, open, onClose }: { curri ...@@ -126,10 +89,10 @@ export default function CurriculumPreview({ curriculum, open, onClose }: { curri
} }
> >
<ListItemAvatar sx={{ mr: 0.75 }}> <ListItemAvatar sx={{ mr: 0.75 }}>
<Avatar alt={curriculum.curriculumName} size="lg" src={curriculum.curriculumImage} /> <Avatar alt={curriculum.curriculumTitle} size="lg" src={curriculum.curriculumImage} />
</ListItemAvatar> </ListItemAvatar>
<ListItemText <ListItemText
primary={<Typography variant="h5">{curriculum.curriculumName}</Typography>} primary={<Typography variant="h5">{curriculum.curriculumTitle}</Typography>}
secondary={<Typography color="secondary"> {curriculumLevels.find(level => level.id === curriculum.curriculumLevel)?.description || ""}</Typography>} secondary={<Typography color="secondary"> {curriculumLevels.find(level => level.id === curriculum.curriculumLevel)?.description || ""}</Typography>}
/> />
</ListItem> </ListItem>
......
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