├── .gitignore ├── views ├── Staff │ ├── studentReport.ejs │ ├── login.ejs │ ├── resetPassword.ejs │ ├── forgotPassword.ejs │ ├── dashboard.ejs │ ├── timetable.ejs │ ├── selectClass.ejs │ ├── selectClassReport.ejs │ └── selectClassAttendance.ejs ├── Includes │ ├── navbar.ejs │ ├── end.ejs │ ├── begin.ejs │ ├── admin_end.ejs │ ├── staff_end.ejs │ ├── student_end.ejs │ ├── messages.ejs │ ├── student_nav.ejs │ ├── staff_nav.ejs │ └── admin_nav.ejs ├── Student │ ├── login.ejs │ ├── resetPassword.ejs │ ├── forgotPassword.ejs │ ├── selectAttendance.ejs │ ├── dashboard.ejs │ ├── timetable.ejs │ └── attendance.ejs ├── error404.ejs ├── Admin │ ├── login.ejs │ ├── register.ejs │ ├── resetPassword.ejs │ ├── forgotPassword.ejs │ ├── Department │ │ ├── addDept.ejs │ │ ├── getDept.ejs │ │ └── setDept.ejs │ ├── passwordSettings.ejs │ ├── dashboard.ejs │ ├── Student │ │ ├── deptSelect.ejs │ │ └── getStudent.ejs │ ├── Staff │ │ ├── selectStaff.ejs │ │ └── getStaff.ejs │ ├── infoSettings.ejs │ ├── Course │ │ ├── getCourse.ejs │ │ ├── deptSelect.ejs │ │ └── addCourse.ejs │ └── Class │ │ ├── getClass.ejs │ │ └── addClass.ejs ├── error403.ejs ├── landing.ejs └── index.ejs ├── docs ├── usecase.jpg ├── db_design.png ├── er_model.png ├── architecture.png └── CMSNSIT_Report.pdf ├── public ├── CSS │ ├── main.css │ ├── admin-profile.css │ ├── error404.css │ ├── admin-dashboard.css │ └── student-dashboard.css └── JS │ └── attendance.js ├── controllers └── home.js ├── routes ├── home.js ├── student.js ├── staff.js └── admin.js ├── database ├── mysql.js ├── seed │ └── timetable.js └── cms.sql ├── package.json ├── LICENSE ├── app.js ├── middlewares ├── adminAuth.js ├── staffAuth.js └── studentAuth.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env -------------------------------------------------------------------------------- /views/Staff/studentReport.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/usecase.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vishal1003/CUMS_DBMS/HEAD/docs/usecase.jpg -------------------------------------------------------------------------------- /docs/db_design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vishal1003/CUMS_DBMS/HEAD/docs/db_design.png -------------------------------------------------------------------------------- /docs/er_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vishal1003/CUMS_DBMS/HEAD/docs/er_model.png -------------------------------------------------------------------------------- /docs/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vishal1003/CUMS_DBMS/HEAD/docs/architecture.png -------------------------------------------------------------------------------- /docs/CMSNSIT_Report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vishal1003/CUMS_DBMS/HEAD/docs/CMSNSIT_Report.pdf -------------------------------------------------------------------------------- /public/CSS/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-bottom: 30px; 3 | position: relative; 4 | min-height: 100%; 5 | } 6 | 7 | a { 8 | transition: background 0.2s, color 0.2s; 9 | } 10 | 11 | a:hover, 12 | a:focus { 13 | text-decoration: none; 14 | } 15 | 16 | .hidden { 17 | display: none; 18 | } -------------------------------------------------------------------------------- /views/Includes/navbar.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /controllers/home.js: -------------------------------------------------------------------------------- 1 | exports.getIndex = (req, res, next) => { 2 | res.render('index'); 3 | }; 4 | 5 | exports.getLanding = (req, res, next) => { 6 | res.render('landing'); 7 | } 8 | 9 | exports.getError403 = (req, res, next) => { 10 | res.render('error403'); 11 | } 12 | 13 | exports.getError404 = (req, res, next) => { 14 | res.render('error404'); 15 | } 16 | -------------------------------------------------------------------------------- /public/CSS/admin-profile.css: -------------------------------------------------------------------------------- 1 | .display-2 { 2 | font-size: 2.75rem; 3 | font-weight: 600; 4 | line-height: 1.5; 5 | } 6 | .mask { 7 | position: absolute; 8 | top: 0; 9 | left: 0; 10 | width: 100%; 11 | height: 100%; 12 | transition: all .15s ease; 13 | } 14 | 15 | @media screen and (prefers-reduced-motion: reduce) { 16 | .mask { 17 | transition: none; 18 | } 19 | } -------------------------------------------------------------------------------- /routes/home.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const homeController = require('../controllers/home'); 3 | 4 | const router = express.Router(); 5 | router.get('/', homeController.getLanding); 6 | 7 | router.get('/index', homeController.getIndex); 8 | 9 | router.get('/unauthorized', homeController.getError403); 10 | 11 | // should be in last 12 | router.use('/', homeController.getError404); 13 | 14 | module.exports = router; 15 | -------------------------------------------------------------------------------- /public/CSS/error404.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Trocchi; 3 | font-size: 50px; 4 | color: steelblue; 5 | text-align: center; 6 | } 7 | 8 | #container { 9 | margin: 100px; 10 | display: align-self; 11 | flex-flow: row wrap; 12 | align-items: center; 13 | } 14 | 15 | 16 | #middle { 17 | margin-top: -90px; 18 | font-size: 250px; 19 | font-weight: bold; 20 | } 21 | 22 | #bottom { 23 | font-size: 30px; 24 | } 25 | 26 | #errormsg { 27 | font-size: small; 28 | display: block; 29 | } -------------------------------------------------------------------------------- /database/mysql.js: -------------------------------------------------------------------------------- 1 | const mysql = require('mysql'); 2 | 3 | module.exports = class Mysql { 4 | static connect() { 5 | // establish connection 6 | const db = mysql.createConnection({ 7 | host: process.env.DB_HOST, 8 | user: process.env.DB_USER, 9 | password: process.env.DB_PASS, 10 | database: 'cumsdbms', 11 | }); 12 | // connect to database 13 | db.connect((err) => { 14 | if (err) { 15 | throw err; 16 | } 17 | console.log('Mysql Connected'); 18 | }); 19 | return db; 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /views/Includes/end.ejs: -------------------------------------------------------------------------------- 1 | 4 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /views/Includes/begin.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CMS NSIT 8 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /views/Includes/admin_end.ejs: -------------------------------------------------------------------------------- 1 | 4 | 7 | 10 | 11 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cums_dbms", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "nodemon app.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/Vishal1003/CUMS_DBMS.git" 13 | }, 14 | "author": "Vishal Jha", 15 | "license": "ISC", 16 | "bugs": { 17 | "url": "https://github.com/Vishal1003/CUMS_DBMS/issues" 18 | }, 19 | "homepage": "https://github.com/Vishal1003/CUMS_DBMS#readme", 20 | "dependencies": { 21 | "bcryptjs": "^2.4.3", 22 | "connect-flash": "^0.1.1", 23 | "cookie-parser": "^1.4.5", 24 | "cors": "^2.8.5", 25 | "dotenv": "^8.2.0", 26 | "ejs": "^3.1.5", 27 | "express": "^4.17.1", 28 | "express-session": "^1.17.1", 29 | "jsonwebtoken": "^8.5.1", 30 | "mailgun-js": "^0.22.0", 31 | "method-override": "^3.0.0", 32 | "mysql": "^2.18.1", 33 | "nodemon": "^2.0.7", 34 | "uuid": "^8.3.2" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /views/Includes/staff_end.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 15 | 18 | 19 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /views/Includes/student_end.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 15 | 18 | 19 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Vishal - Ritik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /public/CSS/admin-dashboard.css: -------------------------------------------------------------------------------- 1 | .dropdown-content { 2 | display: none; 3 | position: absolute; 4 | background-color: #f9f9f9; 5 | min-width: 220px; 6 | box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); 7 | z-index: 1; 8 | } 9 | 10 | .dropdown-content a { 11 | color: black; 12 | padding: 12px 16px; 13 | text-decoration: none; 14 | display: block; 15 | } 16 | 17 | .dropdown-content a:hover { 18 | background-color: #f1f1f1; 19 | } 20 | 21 | .dropdown:hover .dropdown-content { 22 | display: block; 23 | } 24 | 25 | /* Dropup Button */ 26 | .dropup { 27 | position: relative; 28 | display: inline-block; 29 | } 30 | 31 | .dropup-content { 32 | display: none; 33 | position: absolute; 34 | bottom: 40px; 35 | background-color: #f9f9f9; 36 | min-width: 220px; 37 | box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); 38 | z-index: 1; 39 | } 40 | 41 | .dropup-content a { 42 | color: black; 43 | padding: 12px 16px; 44 | text-decoration: none; 45 | display: block; 46 | } 47 | 48 | .dropup-content a:hover { 49 | background-color: #f1f1f1; 50 | } 51 | 52 | .dropup:hover .dropup-content { 53 | display: block; 54 | } 55 | 56 | .ddbtn { 57 | width: 250px; 58 | } 59 | -------------------------------------------------------------------------------- /routes/student.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const controller = require('../controllers/student'); 3 | const { requireAuth, forwardAuth } = require('../middlewares/studentAuth'); 4 | 5 | const router = express.Router(); 6 | 7 | // get login page 8 | router.get('/login', forwardAuth, controller.getLogin); 9 | router.post('/login', controller.postLogin); 10 | 11 | router.get('/dashboard', requireAuth, controller.getDashboard); 12 | router.get('/profile', requireAuth, controller.getProfile); 13 | 14 | router.get('/selectAttendance', requireAuth, controller.getSelectAttendance); 15 | router.post('/selectAttendance', requireAuth, controller.postSelectAttendance); 16 | 17 | router.get('/timetable', requireAuth, controller.getTimeTable); 18 | 19 | router.get('/logout', requireAuth, controller.getLogout); 20 | 21 | // 1.5 FORGET PASSWORD 22 | router.get('/forgot-password', forwardAuth, controller.getForgotPassword); 23 | router.put('/forgot-password', controller.forgotPassword); 24 | 25 | // 1.6 RESET PASSWORD 26 | router.get('/resetpassword/:id', forwardAuth, controller.getResetPassword); 27 | router.put('/resetpassword', controller.resetPassword); 28 | 29 | module.exports = router; 30 | -------------------------------------------------------------------------------- /views/Includes/messages.ejs: -------------------------------------------------------------------------------- 1 | <% if(typeof errors != 'undefined'){ %> <% errors.forEach(function(error) { %> 2 | 8 | <% }); %> <% } %> <% if(success_msg != ''){ %> 9 | 15 | <% } %> <% if(error_msg != ''){ %> 16 | 22 | <% } %> <% if(error != ''){ %> 23 | 29 | <% } %> -------------------------------------------------------------------------------- /routes/staff.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const controller = require('../controllers/staff'); 3 | const { requireAuth, forwardAuth } = require('../middlewares/staffAuth'); 4 | 5 | const router = express.Router(); 6 | 7 | // login page 8 | router.get('/login', forwardAuth, controller.getLogin); 9 | router.post('/login', controller.postLogin); 10 | 11 | router.get('/dashboard', requireAuth, controller.getDashboard); 12 | router.get('/profile', requireAuth, controller.getProfile); 13 | router.get('/logout', requireAuth, controller.getLogout); 14 | 15 | router.get('/student-attendance', requireAuth, controller.getAttendance); 16 | // router.get('/student-attendance/class/:id', requireAuth, controller.markAttendance); 17 | 18 | router.post( 19 | '/student-attendance/class/:id', 20 | requireAuth, 21 | controller.postAttendance 22 | ); 23 | 24 | router.get('/timetable', requireAuth, controller.getTimeTable); 25 | 26 | router.post('/student-attendance', requireAuth, controller.markAttendance); 27 | 28 | router.get('/student-report', requireAuth, controller.getStudentReport); 29 | 30 | router.get('/class-report', requireAuth, controller.selectClassReport); 31 | router.get('/class-report/class/:id', requireAuth, controller.getClassReport); 32 | 33 | // 1.5 FORGET PASSWORD 34 | router.get('/forgot-password', forwardAuth, controller.getForgotPassword); 35 | router.put('/forgot-password', controller.forgotPassword); 36 | 37 | // 1.6 RESET PASSWORD 38 | router.get('/resetpassword/:id', forwardAuth, controller.getResetPassword); 39 | router.put('/resetpassword', controller.resetPassword); 40 | 41 | module.exports = router; 42 | -------------------------------------------------------------------------------- /public/JS/attendance.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | // Set default value of calendar as today's date 3 | const today = new Date(); 4 | const year = today.getFullYear().toString(); 5 | let month = (today.getMonth() + 1).toString(); 6 | let day = today.getDate().toString(); 7 | if (month.length == 1) { 8 | month = '0' + month; 9 | } 10 | if (day.length == 1) { 11 | day = '0' + day; 12 | } 13 | let date = year + '-' + month + '-' + day; 14 | $('#date-input').val(date); 15 | 16 | // Date onChange handle 17 | $('#date-input').change(function () { 18 | const attendance_date = $('#date-input').val(); 19 | $("input[type='checkbox']").each(function () { 20 | const isPresent = $(this).prop('checked'); 21 | }); 22 | }); 23 | 24 | // Mark all present button 25 | $('#mark-all-present').click(function () { 26 | $("input[type='checkbox']").each(function () { 27 | const s_id = $(this).attr('id'); 28 | $(`input[name=${s_id}]`).val('True'); 29 | $(this).prop('checked', true); 30 | }); 31 | }); 32 | // Mark all absent button 33 | $('#mark-all-absent').click(function () { 34 | $("input[type='checkbox']").each(function () { 35 | const s_id = $(this).attr('id'); 36 | $(`input[name=${s_id}]`).val('False'); 37 | $(this).prop('checked', false); 38 | }); 39 | }); 40 | 41 | // onClick checkbox toggle 42 | $("input[type='checkbox']").click(function () { 43 | const s_id = $(this).attr('id'); 44 | let isPresent = $(`input[name=${s_id}]`).val(); 45 | if (isPresent == 'False') { 46 | isPresent = 'True'; 47 | } else { 48 | isPresent = 'False'; 49 | } 50 | $(`input[name=${s_id}]`).val(isPresent); 51 | }); 52 | }); 53 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const env = require('dotenv'); 3 | const express = require('express'); 4 | const bodyParser = require('body-parser'); 5 | const cookieParser = require('cookie-parser'); 6 | const flash = require('connect-flash'); 7 | const session = require('express-session'); 8 | const cors = require('cors'); 9 | const methodOverride = require('method-override'); 10 | 11 | const sql = require('./database/mysql'); 12 | 13 | env.config(); 14 | const app = express(); 15 | 16 | app.use(cors()); 17 | app.use(methodOverride('_method')); 18 | 19 | sql.connect(); 20 | 21 | app.set('view engine', 'ejs'); 22 | app.set('views', 'views'); 23 | 24 | app.use( 25 | session({ 26 | secret: process.env.SESSION_SECRET, 27 | resave: true, 28 | saveUninitialized: true, 29 | }) 30 | ); 31 | 32 | app.use(flash()); 33 | 34 | // Global variables 35 | app.use((req, res, next) => { 36 | res.locals.success_msg = req.flash('success_msg'); 37 | res.locals.error_msg = req.flash('error_msg'); 38 | res.locals.error = req.flash('error'); 39 | next(); 40 | }); 41 | 42 | const adminRoutes = require('./routes/admin'); 43 | const staffRoutes = require('./routes/staff'); 44 | const studentRoutes = require('./routes/student'); 45 | const homeRoutes = require('./routes/home'); 46 | 47 | app.use(bodyParser.urlencoded({ extended: false })); 48 | app.use(express.static(__dirname + '/public')); 49 | app.use(express.urlencoded({ extended: false })); 50 | app.use(express.json()); 51 | app.use(cookieParser()); 52 | 53 | app.use('/admin', adminRoutes); 54 | app.use('/staff', staffRoutes); 55 | app.use('/student', studentRoutes); 56 | app.use('/', homeRoutes); 57 | 58 | // Home Page 59 | app.use(homeRoutes); 60 | 61 | const PORT = process.env.PORT || 5000; 62 | app.listen(PORT, () => { 63 | console.log(`Server started @ ${PORT}`); 64 | }); 65 | -------------------------------------------------------------------------------- /views/Student/login.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 |
4 |
5 |
6 |

STUDENT LOGIN

7 |
8 |
9 |
10 |
11 |
12 |
13 |

Login

14 | <%- include('../Includes/messages') %> 15 |
16 |
17 | 18 | 20 |
21 |
22 | 23 | 25 |
26 | 27 |
28 |

29 | Forgot Password? Generate New Password 30 |

31 |
32 |
33 |
34 |
35 | 36 |
37 |
38 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /views/Staff/login.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 | 4 |
5 |
6 |
7 |

STAFF LOGIN

8 |
9 | 10 |
11 | 12 |
13 |
14 |
15 |
16 |

Login

17 | <%- include('../Includes/messages') %> 18 |
19 |
20 | 21 | 23 |
24 |
25 | 26 | 28 |
29 | 30 |
31 |

32 | Forgot Password? Generate New Password 33 |

34 |
35 |
36 |
37 |
38 | 39 |
40 |
41 | 42 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /middlewares/adminAuth.js: -------------------------------------------------------------------------------- 1 | const jwt = require('jsonwebtoken'); 2 | const mysql = require('mysql'); 3 | 4 | const db = mysql.createConnection({ 5 | host: process.env.DB_HOST, 6 | user: process.env.DB_USER, 7 | password: process.env.DB_PASS, 8 | dateStrings: 'date', 9 | database: 'cumsdbms', 10 | }); 11 | 12 | const selectID = (id) => { 13 | return new Promise((resolve, reject) => { 14 | const sql1 = 'SELECT name FROM admin WHERE admin_id = ?'; 15 | db.query(sql1, [id], (err, results) => { 16 | if (err) return reject(err); 17 | return resolve(results); 18 | }); 19 | }); 20 | }; 21 | 22 | const requireAuth = (req, res, next) => { 23 | const token = req.cookies.jwt; 24 | if (token) { 25 | jwt.verify(token, process.env.JWT_SECRET, async (err, result) => { 26 | if (err) { 27 | req.flash( 28 | 'error_msg', 29 | 'You need to login as ADMIN in order to view that source!' 30 | ); 31 | res.redirect('/unauthorized'); 32 | } else { 33 | const data = await selectID(result.id); 34 | if (data.length === 0) { 35 | req.flash( 36 | 'error_msg', 37 | 'You need to login as ADMIN in order to view that source!' 38 | ); 39 | res.redirect('/unauthorized'); 40 | } else { 41 | req.user = result.id; 42 | next(); 43 | } 44 | } 45 | }); 46 | } else { 47 | req.flash( 48 | 'error_msg', 49 | 'You need to login as ADMIN in order to view that source!' 50 | ); 51 | res.redirect('/unauthorized'); 52 | } 53 | }; 54 | 55 | const forwardAuth = (req, res, next) => { 56 | const token = req.cookies.jwt; 57 | if (token) { 58 | jwt.verify(token, process.env.JWT_SECRET, async (err, result) => { 59 | if (err) { 60 | next(); 61 | } else { 62 | const data = await selectID(result.id); 63 | if (data.length === 0) { 64 | next(); 65 | } else { 66 | req.user = result.id; 67 | res.redirect('/admin/dashboard'); 68 | } 69 | } 70 | }); 71 | } else { 72 | next(); 73 | } 74 | }; 75 | 76 | module.exports = { requireAuth, forwardAuth }; 77 | -------------------------------------------------------------------------------- /middlewares/staffAuth.js: -------------------------------------------------------------------------------- 1 | const jwt = require('jsonwebtoken'); 2 | const mysql = require('mysql'); 3 | 4 | const db = mysql.createConnection({ 5 | host: process.env.DB_HOST, 6 | user: process.env.DB_USER, 7 | password: process.env.DB_PASS, 8 | dateStrings: 'date', 9 | database: 'cumsdbms', 10 | }); 11 | 12 | const selectID = (id) => { 13 | return new Promise((resolve, reject) => { 14 | const sql1 = 'SELECT st_name FROM staff WHERE st_id = ?'; 15 | db.query(sql1, [id], (err, results) => { 16 | if (err) return reject(err); 17 | return resolve(results); 18 | }); 19 | }); 20 | }; 21 | 22 | const requireAuth = (req, res, next) => { 23 | const token = req.cookies.jwt; 24 | if (token) { 25 | jwt.verify(token, process.env.JWT_SECRET, async (err, result) => { 26 | if (err) { 27 | req.flash( 28 | 'error_msg', 29 | 'You need to login as STAFF in order to view that source!' 30 | ); 31 | res.redirect('/unauthorized'); 32 | } else { 33 | const data = await selectID(result.id); 34 | if (data.length === 0) { 35 | req.flash( 36 | 'error_msg', 37 | 'You need to login as STAFF in order to view that source!' 38 | ); 39 | res.redirect('/unauthorized'); 40 | } else { 41 | req.user = result.id; 42 | next(); 43 | } 44 | } 45 | }); 46 | } else { 47 | req.flash( 48 | 'error_msg', 49 | 'You need to login as STAFF in order to view that source!' 50 | ); 51 | res.redirect('/unauthorized'); 52 | } 53 | }; 54 | 55 | const forwardAuth = (req, res, next) => { 56 | const token = req.cookies.jwt; 57 | if (token) { 58 | jwt.verify(token, process.env.JWT_SECRET, async (err, result) => { 59 | if (err) { 60 | next(); 61 | } else { 62 | const data = await selectID(result.id); 63 | if (data.length === 0) { 64 | next(); 65 | } else { 66 | req.user = result.id; 67 | res.redirect('/staff/dashboard'); 68 | } 69 | } 70 | }); 71 | } else { 72 | next(); 73 | } 74 | }; 75 | 76 | module.exports = { requireAuth, forwardAuth }; 77 | -------------------------------------------------------------------------------- /middlewares/studentAuth.js: -------------------------------------------------------------------------------- 1 | const jwt = require('jsonwebtoken'); 2 | const mysql = require('mysql'); 3 | 4 | const db = mysql.createConnection({ 5 | host: process.env.DB_HOST, 6 | user: process.env.DB_USER, 7 | password: process.env.DB_PASS, 8 | dateStrings: 'date', 9 | database: 'cumsdbms', 10 | }); 11 | 12 | const selectID = (id) => { 13 | return new Promise((resolve, reject) => { 14 | const sql1 = 'SELECT s_name FROM student WHERE s_id = ?'; 15 | db.query(sql1, [id], (err, results) => { 16 | if (err) return reject(err); 17 | return resolve(results); 18 | }); 19 | }); 20 | }; 21 | 22 | const requireAuth = (req, res, next) => { 23 | const token = req.cookies.jwt; 24 | if (token) { 25 | jwt.verify(token, process.env.JWT_SECRET, async (err, result) => { 26 | if (err) { 27 | req.flash( 28 | 'error_msg', 29 | 'You need to login as STUDENT in order to view that source! ==> ' 30 | ); 31 | res.redirect('/unauthorized'); 32 | } else { 33 | const data = await selectID(result.id); 34 | if (data.length === 0) { 35 | req.flash( 36 | 'error_msg', 37 | 'You need to login as STUDENT in order to view that source! abc k' 38 | ); 39 | res.redirect('/unauthorized'); 40 | } else { 41 | req.user = result.id; 42 | next(); 43 | } 44 | } 45 | }); 46 | } else { 47 | req.flash( 48 | 'error_msg', 49 | 'You need to login as STUDENT in order to view that source! kkk' 50 | ); 51 | res.redirect('/unauthorized'); 52 | } 53 | }; 54 | 55 | const forwardAuth = (req, res, next) => { 56 | const token = req.cookies.jwt; 57 | if (token) { 58 | jwt.verify(token, process.env.JWT_SECRET, async (err, result) => { 59 | if (err) { 60 | next(); 61 | } else { 62 | const data = await selectID(result.id); 63 | if (data.length === 0) { 64 | next(); 65 | } else { 66 | req.user = result.id; 67 | res.redirect('/student/dashboard'); 68 | } 69 | } 70 | }); 71 | } else { 72 | next(); 73 | } 74 | }; 75 | 76 | module.exports = { requireAuth, forwardAuth }; 77 | -------------------------------------------------------------------------------- /views/error404.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CMS NSIT 8 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 34 | 35 | 36 |
37 |
Oops!
38 |
404
39 |
Sorry, couldn't find what you're looking for!
40 | 41 | 44 | 45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 57 | 60 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /views/Includes/student_nav.ejs: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | 51 | 52 | -------------------------------------------------------------------------------- /views/Admin/login.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 |
4 |
5 |
6 |

ADMIN LOGIN

7 |
8 |
9 |
10 |
11 |
12 |
14 |

Login

15 | <%- include('../Includes/messages') %> 16 |
17 |
18 | 19 | 21 |
22 |
23 | 24 | 26 |
27 | 28 |
29 |

30 | No Account? Register 31 |

32 |

33 | Forgot Password? Generate New Password 34 |

35 |
36 |
37 |
38 |
39 | 40 |
41 |
42 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/register.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 | 4 |
5 |
6 |
7 |

ADMIN REGISTER

8 |
9 |
10 |
11 |
12 |
13 |
14 |

Register

16 | <%- include('../Includes/messages') %> 17 |
18 |
19 | 20 | 22 |
23 |
24 | 25 | 27 |
28 |
29 | 30 | 32 |
33 |
34 | 35 | 37 |
38 | 39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | 47 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /views/Includes/staff_nav.ejs: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | 57 | 58 | -------------------------------------------------------------------------------- /views/error403.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CMS NSIT 8 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 34 | 35 | 36 |
37 |
Oops!
38 |
403
39 |
Sorry, you are not authorized!
40 | 41 | 44 | 47 | 48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 60 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /views/Admin/resetPassword.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 | 4 |
5 |
6 |
7 |
8 |
9 |
10 |

Reset your password

11 |

Change your password. Make sure it's healthy and safe!

12 |

NOTE: The link will expire in 20m

13 | 14 |
15 | <%- include('../Includes/messages') %> 16 |
17 |
18 |
20 | Enter a new 22 | password 23 |
24 |
25 | Confirm password 27 |
28 |
29 | 31 | 32 |
33 |
34 | 36 |
37 |
38 |
39 |
40 |
41 | 42 | 43 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /views/Staff/resetPassword.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 | 4 |
5 |
6 |
7 |
8 |
9 |
10 |

Reset your password

11 |

Change your password. Make sure it's healthy and safe!

12 |

NOTE: The link will expire in 20m

13 | 14 |
15 | <%- include('../Includes/messages') %> 16 |
17 |
18 |
20 | Enter a new 22 | password 23 |
24 |
25 | Confirm password 27 |
28 |
29 | 31 | 32 |
33 |
34 | 36 |
37 |
38 |
39 |
40 |
41 | 42 | 43 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /views/Student/resetPassword.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 | 4 |
5 |
6 |
7 |
8 |
9 |
10 |

Reset your password

11 |

Change your password. Make sure it's healthy and safe!

12 |

NOTE: The link will expire in 20m

13 | 14 |
15 | <%- include('../Includes/messages') %> 16 |
17 |
18 |
20 | Enter a new 22 | password 23 |
24 |
25 | Confirm password 27 |
28 |
29 | 31 | 32 |
33 |
34 | 36 |
37 |
38 |
39 |
40 |
41 | 42 | 43 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /views/landing.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CMS NSIT 8 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 31 | 32 |
33 |
34 |
35 |

Welcome to CMS NSIT

36 |

College Management Site that provides complete functionality to manage 37 | enrollment, students, faculty, 38 | attendance, scheduling, assignments and grades.

39 | Enter 40 |
41 | 42 |
43 | image 44 |
45 |
46 |
47 | 48 |
49 |

An original work crafted by Vishal and Ritik

50 |
51 | 52 | 55 | 58 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /views/Admin/forgotPassword.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 | 4 |
5 |
6 |
7 |
8 |
9 |
10 |

Forgot your password?

11 |

Change your password in three easy steps. This will help you to secure your password! 12 |

13 |
    14 |
  1. 1. Enter your email address below. 15 |
  2. 16 |
  3. 2. Our system will send you a 17 | temporary 18 | link
  4. 19 |
  5. 3. Use the link to reset your 20 | password 21 |
  6. 22 |
23 |
24 | <%- include('../Includes/messages') %> 25 |
27 |
28 |
29 | 30 | Enter the email address you 32 | used during the 33 | registration. Then we'll email a link to this address. 34 |
35 |
36 | 37 | 38 |
39 |
40 | 42 |
43 |
44 |
45 |
46 |
47 | 48 | 49 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /views/Staff/forgotPassword.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 | 4 |
5 |
6 |
7 |
8 |
9 |
10 |

Forgot your password?

11 |

Change your password in three easy steps. This will help you to secure your password! 12 |

13 |
    14 |
  1. 1. Enter your email address below. 15 |
  2. 16 |
  3. 2. Our system will send you a 17 | temporary 18 | link
  4. 19 |
  5. 3. Use the link to reset your 20 | password 21 |
  6. 22 |
23 |
24 | <%- include('../Includes/messages') %> 25 |
27 |
28 |
29 | 30 | Enter the email address you 32 | used during the 33 | registration. Then we'll email a link to this address. 34 |
35 |
36 | 37 | 38 |
39 |
40 | 42 |
43 |
44 |
45 |
46 |
47 | 48 | 49 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /views/Student/forgotPassword.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/navbar.ejs') %> 3 | 4 |
5 |
6 |
7 |
8 |
9 |
10 |

Forgot your password?

11 |

Change your password in three easy steps. This will help you to secure your password! 12 |

13 |
    14 |
  1. 1. Enter your email address below. 15 |
  2. 16 |
  3. 2. Our system will send you a 17 | temporary 18 | link
  4. 19 |
  5. 3. Use the link to reset your 20 | password 21 |
  6. 22 |
23 |
24 | <%- include('../Includes/messages') %> 25 |
27 |
28 |
29 | 30 | Enter the email address you 32 | used during the 33 | registration. Then we'll email a link to this address. 34 |
35 |
36 | 37 | 38 |
39 |
40 | 42 |
43 |
44 |
45 |
46 |
47 | 48 | 49 | <%- include('../Includes/end.ejs') %> -------------------------------------------------------------------------------- /database/seed/timetable.js: -------------------------------------------------------------------------------- 1 | const mysql = require('mysql'); 2 | const env = require('dotenv'); 3 | env.config(); 4 | const db = mysql.createConnection({ 5 | host: process.env.DB_HOST, 6 | user: process.env.DB_USER, 7 | password: process.env.DB_PASS, 8 | database: 'cumsdbms', 9 | }); 10 | db.connect((err) => { 11 | if (err) { 12 | throw err; 13 | } 14 | console.log('Mysql Connected'); 15 | }); 16 | // Database query promises 17 | const zeroParamPromise = (sql) => { 18 | return new Promise((resolve, reject) => { 19 | db.query(sql, (err, results) => { 20 | if (err) return reject(err); 21 | return resolve(results); 22 | }); 23 | }); 24 | }; 25 | 26 | const queryParamPromise = (sql, queryParam) => { 27 | return new Promise((resolve, reject) => { 28 | db.query(sql, queryParam, (err, results) => { 29 | if (err) { 30 | return reject(err); 31 | } 32 | return resolve(results); 33 | }); 34 | }); 35 | }; 36 | const startTime = ['10:00:00', '11:00:00', '12:00:00', '13:00:00']; 37 | const endTime = ['11:00:00', '12:00:00', '13:00:00', '14:00:00']; 38 | // Currently implemented only for 1st semester, 2021 joining year students of all departments 39 | // Assumed only one subject per teacher but can be generalized with an extra 2D array 40 | async function generateTimeTable() { 41 | try { 42 | await new Promise((r) => setTimeout(r, 2000)); // wait for mysql connection 43 | await zeroParamPromise('TRUNCATE TABLE time_table'); 44 | console.log('Time Table Truncated'); 45 | const classesData = await zeroParamPromise('select * from class'); 46 | let departmentsData = await zeroParamPromise( 47 | 'select dept_id from department' 48 | ); 49 | for (let i = 0; i < departmentsData.length; ++i) { 50 | departmentsData[i] = departmentsData[i].dept_id; 51 | } 52 | // time table for all departments and 3 sections each 53 | const timeTable = new Array(departmentsData.length * 3); 54 | for (let day = 0; day < 5; ++day) { 55 | console.log(day); 56 | // Four time slots for each class 57 | for (let i = 0; i < timeTable.length; ++i) { 58 | timeTable[i] = new Array(4); 59 | } 60 | console.table(timeTable); 61 | for (const classData of classesData) { 62 | const dept = ( 63 | await queryParamPromise('select dept_id from course where c_id = ?', [ 64 | classData.c_id, 65 | ]) 66 | )[0].dept_id; 67 | const section = classData.section - 1; 68 | const row = departmentsData.indexOf(dept) * 3 + section; 69 | console.log(dept, section, row); 70 | let col = Math.floor(Math.random() * timeTable[row].length); 71 | while (timeTable[row][col] !== undefined) { 72 | col = Math.floor(Math.random() * timeTable[row].length); 73 | } 74 | timeTable[row][col] = classData.class_id; 75 | await queryParamPromise('insert into time_table set ?', { 76 | c_id: classData.c_id, 77 | st_id: classData.st_id, 78 | start_time: startTime[col], 79 | end_time: endTime[col], 80 | section, 81 | day: day, 82 | }); 83 | } 84 | console.table(timeTable); 85 | } 86 | } catch (err) { 87 | throw err; 88 | } finally { 89 | process.exit(); 90 | } 91 | } 92 | generateTimeTable(); 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CUMS_DBMS 2 | 🏰 A College Management Site (DBMS) using Node and Mysql. 3 | 4 | A college management system (web application) that provides complete funtionality to manage enrollment, students, faculty, attendance, fees, scheduling, 5 | assignments and grades for a particular college.It uses Node.js for backend and MySql as Database. 6 | 7 | The purpose of this application is to automate the existing manual system by the help of computerized equipment and full-fledged computer software, fulfilling their requirements, so that their valuable data/information can be stored for a longer period with easy accessing and manipulation of the same. The required software and hardware are easily available and easy to work with. 8 | 9 | 10 | **SEE THE COMPLETE REPORT HERE** [Report](docs/CMSNSIT_Report.pdf) 11 | 12 | 13 | ## Product Features and User Classifications 14 | 15 | There are several types of end users for the CMS. They are broadly divided as Students, Staff and the Administrator. Each of these classes have their own set of features 16 | 17 | - **ADMIN** who can view and edit the details of any students/staff. Can add/edit departments, courses, classes and time-tables. 18 | - **STAFF** who can view students details, add/update assignments, marks and attendance of a particular student. They can see the time-table of a particular class also. 19 | - **STUDENT** who can update profile/ add solution to assignments and see marks/attendance. 20 | 21 | 22 | ## System Design 23 | 24 | 25 | ### UseCase Diagram 26 | 27 | This is the use case diagram which depicts the user’s interaction with the system. It also shows the relationship between the user and the different use cases in which the user is involved. 28 | 29 | ![docs/usecase.jpg](docs/usecase.jpg) 30 | 31 | 32 | ### Database Design 33 | 34 | We are using MySQL as our database. The main objective of this project is to use Relational Database and hence MySQL is the best choice for that. 35 | 36 | *User can perform the above operations without writing any database query by using our simple and convenient User Interface.* 37 | 38 | 39 | **CLASS DIAGRAM** 40 | 41 | ![docs/db_design.png](docs/db_design.png) 42 | 43 | 44 | **ER MODEL** 45 | 46 | ![docs/er_model.png](docs/er_model.png) 47 | 48 | 49 | ### 3-tier Architecture 50 | 51 | ![docs/architecture.png](docs/architecture.png) 52 | 53 | 54 | 55 | ------------------------------------------------------------------------------- 56 | 57 | **SEE THE COMPLETE REPORT HERE** [Report](docs/CMSNSIT_Report.pdf) 58 | 59 | 60 | 61 | 62 | ## Setting up Project 63 | 64 | * Open Terminal and execute 65 | `https://github.com/Vishal1003/CUMS_DBMS.git` 66 | `cd CUMS_DBMS` 67 | `npm install` 68 | * Create following env variables (in order to connect to database and use JWT) : 69 | * DB_HOST 70 | * DB_USER 71 | * DB_PASS 72 | * PORT 73 | * JWT_SECRET 74 | * JWT_EXPIRE 75 | * SESSION_SECRET 76 | * For setting up mail-gun Go to official doc of mail-gun. Sign up and replace your credentials here. 77 | * URL 78 | * RESET_PASSWORD_KEY 79 | * DOMAIN_NAME 80 | * MAILGUN_API_KEY 81 | * Create the database using following query in mysql : `CREATE DATABASE databasename;` 82 | * Create tables using the sql script file in `databse/cms.sql`; 83 | * To seed data in the database run to file in `seed` folder 84 | * To start the application execute `npm start` 85 | 86 | -------------------------------------------------------------------------------- /views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CMS NSIT 8 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | 31 |
32 |
33 |
34 |

WELCOME TO CMS NSIT

35 |
36 | 37 |
38 | 39 |
40 |
41 |
42 |
44 |

LOGIN

45 | 46 | 49 |
50 | 53 |
54 | 57 | 58 |
59 |
60 |
61 |
62 | 63 |
64 |
65 | 66 | 69 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /views/Includes/admin_nav.ejs: -------------------------------------------------------------------------------- 1 | 99 | 100 | -------------------------------------------------------------------------------- /routes/admin.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const controller = require('../controllers/admin'); 3 | const { requireAuth, forwardAuth } = require('../middlewares/adminAuth'); 4 | 5 | const router = express.Router(); 6 | 7 | // 1. ADMIN 8 | 9 | // 1.1 Login 10 | router.get('/login', forwardAuth, controller.getLogin); 11 | router.post('/login', controller.postLogin); 12 | 13 | // 1.2 Register 14 | router.get('/register', forwardAuth, controller.getRegister); 15 | router.post('/register', controller.postRegister); 16 | 17 | // 1.3 Dashboard 18 | router.get('/dashboard', requireAuth, controller.getDashboard); 19 | 20 | // 1.4 Logout 21 | router.get('/logout', requireAuth, controller.getLogout); 22 | 23 | // 1.5 Profile 24 | router.get('/profile', requireAuth, controller.getProfile); 25 | 26 | // 1.6 Forgot password 27 | router.get('/forgot-password', forwardAuth, controller.getForgotPassword); 28 | router.put('/forgot-password', forwardAuth, controller.forgotPassword); 29 | 30 | // 1.7 Reset Password 31 | router.get('/resetpassword/:id', forwardAuth, controller.getResetPassword); 32 | router.put('/resetpassword', forwardAuth, controller.resetPassword); 33 | 34 | // 1.8 Settings 35 | router.get('/info_settings', requireAuth, controller.getInfoSettings); 36 | router.post('/info_settings', requireAuth, controller.postInfoSettings); 37 | router.get('/password_settings', requireAuth, controller.getPasswordSettings); 38 | router.post('/password_settings', requireAuth, controller.postPasswordSettings); 39 | 40 | // 2.STAFFS 41 | // 2.1 Add staff 42 | router.get('/addStaff', requireAuth, controller.getAddStaff); 43 | router.post('/addStaff', requireAuth, controller.postAddStaff); 44 | // 2.2 Get staffs on query 45 | router.get('/getStaff', requireAuth, controller.getRelevantStaff); 46 | router.post('/getStaff', requireAuth, controller.postRelevantStaff); 47 | // 2.3 Get all staffs 48 | router.get('/getAllStaffs', requireAuth, controller.getAllStaff); 49 | // 2.4 Modify existing staffs 50 | router.get('/settings/staff/:id', requireAuth, controller.getStaffSettings); 51 | router.post('/settings/staff', requireAuth, controller.postStaffSettings); 52 | 53 | // 3.STUDENTS 54 | // 3.1 Add Student 55 | router.get('/addStudent', requireAuth, controller.getAddStudent); 56 | router.post('/addStudent', requireAuth, controller.postAddStudent); 57 | // 3.2 Get Students on query 58 | router.get('/getStudent', requireAuth, controller.getRelevantStudent); 59 | router.post('/getStudent', requireAuth, controller.postRelevantStudent); 60 | // 3.3 Get all Students 61 | router.get('/getAllStudents', requireAuth, controller.getAllStudent); 62 | // 3.4 Modify existing students 63 | router.get('/settings/student/:id', requireAuth, controller.getStudentSettings); 64 | router.post('/settings/student', requireAuth, controller.postStudentSettings); 65 | 66 | // 4.CLASSES (subjects mapping courses ,staffs and section) 67 | // 4.1 Select class 68 | router.get('/getClass', requireAuth, controller.getClass); 69 | // 4.2 Add class 70 | router.get('/addClass', requireAuth, controller.getAddClass); 71 | router.post('/addClass', controller.postAddClass); 72 | // 4.3 Modify existing classes 73 | router.get('/settings/class/:id', requireAuth, controller.getClassSettings); 74 | router.post('/settings/class', requireAuth, controller.postClassSettings); 75 | 76 | // 5.DEPARTMENTS 77 | // 5.1 Select department 78 | router.get('/getDept', requireAuth, controller.getDept); 79 | // 5.2 Add department 80 | router.get('/addDept', requireAuth, controller.getAddDept); 81 | router.post('/addDept', requireAuth, controller.postAddDept); 82 | // 5.3 Modify existing department 83 | router.get('/settings/department/:id', requireAuth, controller.getDeptSettings); 84 | router.post('/settings/department', requireAuth, controller.postDeptSettings); 85 | 86 | // 6.COURSES 87 | // 6.1 Get all courses 88 | router.get('/getAllCourses', requireAuth, controller.getAllCourse); 89 | // 6.2 Get courses on query 90 | router.get('/getCourse', requireAuth, controller.getRelevantCourse); 91 | router.post('/getCourse', requireAuth, controller.postRelevantCourse); 92 | // 6.3 Add course 93 | router.get('/addCourse', requireAuth, controller.getAddCourse); 94 | router.post('/addCourse', requireAuth, controller.postAddCourse); 95 | // 6.4 Modify existing courses 96 | router.get('/settings/course/:id', requireAuth, controller.getCourseSettings); 97 | router.post('/settings/course', requireAuth, controller.postCourseSettings); 98 | 99 | module.exports = router; 100 | -------------------------------------------------------------------------------- /views/Staff/dashboard.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/staff_nav.ejs') %> 3 | 4 |
5 |
6 |
8 |

Hello <%= user.st_name %> 9 |

10 |
11 | 12 |
13 | 14 |
15 |
16 |
17 | image 20 |
21 |
Mark Attendance
22 |

Record Daily Attendace of your students here! You cannot edit/update 23 | the records after one month. 24 |

25 |
26 | 32 |
33 |
34 | 35 |
36 |
37 | image 40 |
41 |
Student Report
42 |

Manage your student's report here (marks). All 43 | your 44 | changes will be reflected to them as well. 45 |

46 | 47 |
48 | 54 |
55 |
56 | 57 |
58 |
59 | image 61 |
62 |
Generate Class Report
63 |

See how well your class is performing! Generate the overall class report (Attendace/Marks) here. 64 |

65 | 66 |
67 | 73 |
74 |
75 |
76 | 77 |
78 |
79 | 80 | <%- include('../Includes/staff_end.ejs') %> -------------------------------------------------------------------------------- /views/Student/selectAttendance.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | 3 | <%- include('../Includes/student_nav.ejs') %> 4 | 5 | 6 |
7 |
8 |
9 | 10 |
12 | 13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |

View Attendance

23 |
24 | 25 |
26 |
27 |
28 |
Select Semester
29 | 30 |
31 |
32 |
33 |
34 |
35 |
36 | 39 | 47 |
48 |
49 |
50 | 52 | 60 |
61 |
62 |
63 | 65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | 78 | <%- include('../Includes/student_end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/Department/addDept.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

ADD NEW DEPARTMENT

27 |
28 | 31 |
32 |
33 |
34 | <%- include('../../Includes/messages') %> 35 |
36 |
Department Information
37 |
38 |
39 |
40 |
41 | 43 | 46 |
47 |
48 |
49 |
50 | 53 | 56 |
57 |
58 |
59 | 60 |
61 |
62 | 64 |
65 | 66 | 67 |
68 |
69 |
70 | 71 | 72 |
73 |
74 |
75 | 76 | 77 | 78 | 79 |
80 |
81 | 82 |
83 | 84 |
85 | 86 | <%- include('../../Includes/admin_end.ejs') %> -------------------------------------------------------------------------------- /views/Staff/timetable.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/staff_nav.ejs') %> 3 |
4 |
5 |
6 | 7 |
9 | 10 |
11 | 12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |

Class Time Table

20 |
21 |
22 |
23 |
24 |
NAME : 25 | <%= staffData.s_name %> || SEMESTER : 26 | 1 27 |
28 |
29 |
30 |
31 |
32 |
33 | 34 | 35 | 36 | 37 | <% for (let i = 0; i < startTimes.length; ++i) {%> 38 | 40 | <%}%> 41 | 42 | 43 | 44 | <% for (let i = 0; i < dayNames.length; ++i) {%> 45 | 46 | 47 | <% for (let j = 0; j < startTimes.length; ++j) {%> 48 | 55 | <%}%> 56 | 57 | <%}%> 58 | 59 |
<%=startTimes[i]%> - <%=endTimes[i]%> 39 |
<%=dayNames[i]%> 49 | <% for (let k = 0; k < timeTableData.length; ++k) {%> 50 | <%if(timeTableData[k].day == i && timeTableData[k].start_time[0] == startTimes[j][0] && timeTableData[k].start_time[1] == startTimes[j][1]) {%> 51 | <%=timeTableData[k].c_id%> 52 | <%}%> 53 | <%}%> 54 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | 69 | 70 |
71 |
72 |
73 |
74 |
75 | 76 | <%- include('../Includes/staff_end.ejs') %> -------------------------------------------------------------------------------- /views/Student/dashboard.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | 3 | <%- include('../Includes/student_nav.ejs') %> 4 | 5 | 6 |
7 |
8 |
10 |

Hello <%= name %> 11 |

12 |
13 | 14 |
15 | 16 |
17 |
18 |
19 | image 22 |
23 |
Attendance
24 |

View the attendance status for each of your courses. (Make sure 25 | that 26 | the atted. is atleast 75%)

27 | 28 |
29 | 35 |
36 |
37 | 38 |
39 |
40 | image 43 |
44 |
Marks
45 |

View the marks obtained for each of your courses. These include 46 | the 47 | marks upto your previous semester.

48 | 49 |
50 | 56 |
57 |
58 | 59 |
60 |
61 | image 64 |
65 |
Time Table
66 |

View your timetable. (It shows the time table of all the 67 | courses 68 | you 69 | have registered for!)

70 | 71 |
72 | 78 |
79 |
80 |
81 | 82 |
83 |
84 | 85 | <%- include('../Includes/student_end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/passwordSettings.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | 3 |
4 |
5 | <%- include('../Includes/admin_nav.ejs') %> 6 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |

ADMIN SETTINGS

20 |
21 |
22 |
23 |
24 | <%- include('../Includes/messages') %> 25 |
26 |
Old Password
27 |
28 |
29 |
30 |
31 | 34 |
35 |
36 |
37 |
38 |
39 |
New Password
40 |
41 |
42 |
43 |
44 | 47 |
48 |
49 |
50 |
51 | 54 |
55 |
56 |
57 |
58 | 60 | 61 |
62 |
63 |
64 | 65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | 73 | <%- include('../Includes/admin_end.ejs') %> -------------------------------------------------------------------------------- /public/CSS/student-dashboard.css: -------------------------------------------------------------------------------- 1 | #wrapper { 2 | padding-left: 0; 3 | transition: all 0.5s ease; 4 | position: relative; 5 | } 6 | 7 | #sidebar-wrapper { 8 | z-index: 1000; 9 | position: fixed; 10 | left: 250px; 11 | width: 0; 12 | height: 100%; 13 | margin-left: -250px; 14 | overflow-y: auto; 15 | overflow-x: hidden; 16 | background: #222; 17 | transition: all 0.5s ease; 18 | } 19 | 20 | #wrapper.toggled #sidebar-wrapper { 21 | width: 250px; 22 | } 23 | 24 | .sidebar-brand { 25 | position: absolute; 26 | top: 0; 27 | width: 250px; 28 | text-align: center; 29 | padding: 20px 0; 30 | } 31 | 32 | .sidebar-brand h2 { 33 | margin: 0; 34 | font-weight: 600; 35 | font-size: 24px; 36 | color: #fff; 37 | } 38 | 39 | .sidebar-nav { 40 | position: absolute; 41 | top: 75px; 42 | width: 250px; 43 | margin: 0; 44 | padding: 0; 45 | list-style: none; 46 | } 47 | 48 | .sidebar-nav > li { 49 | text-indent: 10px; 50 | line-height: 42px; 51 | } 52 | 53 | .sidebar-nav > li a { 54 | display: block; 55 | text-decoration: none; 56 | color: #757575; 57 | font-weight: 600; 58 | font-size: 18px; 59 | } 60 | 61 | .sidebar-nav > li > a:hover, 62 | .sidebar-nav > li.active > a { 63 | text-decoration: none; 64 | color: #fff; 65 | background: #f8be12; 66 | } 67 | 68 | .sidebar-nav > li > a i.fa { 69 | font-size: 24px; 70 | width: 60px; 71 | } 72 | 73 | #navbar-wrapper { 74 | width: 100%; 75 | position: absolute; 76 | z-index: 2; 77 | } 78 | 79 | #wrapper.toggled #navbar-wrapper { 80 | position: absolute; 81 | margin-right: -250px; 82 | } 83 | 84 | #navbar-wrapper .navbar { 85 | border-width: 0 0 0 0; 86 | background-color: #222; 87 | font-size: 24px; 88 | margin-bottom: 0; 89 | border-radius: 0; 90 | } 91 | 92 | #navbar-wrapper .navbar a { 93 | color: #fff; 94 | } 95 | 96 | #navbar-wrapper .navbar a:hover { 97 | color: #f8be12; 98 | } 99 | 100 | #content-wrapper { 101 | width: 100%; 102 | position: absolute; 103 | padding: 15px; 104 | top: 100px; 105 | } 106 | 107 | #wrapper.toggled #content-wrapper { 108 | position: absolute; 109 | margin-right: -250px; 110 | } 111 | 112 | @media (min-width: 992px) { 113 | #wrapper { 114 | padding-left: 250px; 115 | } 116 | 117 | #wrapper.toggled { 118 | padding-left: 60px; 119 | } 120 | 121 | #sidebar-wrapper { 122 | width: 250px; 123 | } 124 | 125 | #wrapper.toggled #sidebar-wrapper { 126 | width: 60px; 127 | } 128 | 129 | #wrapper.toggled #navbar-wrapper { 130 | position: absolute; 131 | margin-right: -190px; 132 | } 133 | 134 | #wrapper.toggled #content-wrapper { 135 | position: absolute; 136 | margin-right: -190px; 137 | } 138 | 139 | #navbar-wrapper { 140 | position: relative; 141 | } 142 | 143 | #wrapper.toggled { 144 | padding-left: 60px; 145 | } 146 | 147 | #content-wrapper { 148 | position: relative; 149 | top: 0; 150 | } 151 | 152 | #wrapper.toggled #navbar-wrapper, 153 | #wrapper.toggled #content-wrapper { 154 | position: relative; 155 | margin-right: 60px; 156 | } 157 | } 158 | 159 | @media (min-width: 768px) and (max-width: 991px) { 160 | #wrapper { 161 | padding-left: 60px; 162 | } 163 | 164 | #sidebar-wrapper { 165 | width: 60px; 166 | } 167 | 168 | #wrapper.toggled #navbar-wrapper { 169 | position: absolute; 170 | margin-right: -250px; 171 | } 172 | 173 | #wrapper.toggled #content-wrapper { 174 | position: absolute; 175 | margin-right: -250px; 176 | } 177 | 178 | #navbar-wrapper { 179 | position: relative; 180 | } 181 | 182 | #wrapper.toggled { 183 | padding-left: 250px; 184 | } 185 | 186 | #content-wrapper { 187 | position: relative; 188 | top: 0; 189 | } 190 | 191 | #wrapper.toggled #navbar-wrapper, 192 | #wrapper.toggled #content-wrapper { 193 | position: relative; 194 | margin-right: 250px; 195 | } 196 | } 197 | 198 | @media (max-width: 767px) { 199 | #wrapper { 200 | padding-left: 0; 201 | } 202 | 203 | #sidebar-wrapper { 204 | width: 0; 205 | } 206 | 207 | #wrapper.toggled #sidebar-wrapper { 208 | width: 250px; 209 | } 210 | 211 | #wrapper.toggled #navbar-wrapper { 212 | position: absolute; 213 | margin-right: -250px; 214 | } 215 | 216 | #wrapper.toggled #content-wrapper { 217 | position: absolute; 218 | margin-right: -250px; 219 | } 220 | 221 | #navbar-wrapper { 222 | position: relative; 223 | } 224 | 225 | #wrapper.toggled { 226 | padding-left: 250px; 227 | } 228 | 229 | #content-wrapper { 230 | position: relative; 231 | top: 0; 232 | } 233 | 234 | #wrapper.toggled #navbar-wrapper, 235 | #wrapper.toggled #content-wrapper { 236 | position: relative; 237 | margin-right: 250px; 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /views/Admin/dashboard.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 |
15 |

Hello <%= user.name %>

16 |
17 | 18 |
19 | 20 |
21 |
22 |
23 | image 26 |
27 |
Manage Staff
28 |

Manage your staff here. You can edit and 29 | can add or remove a staff. All your changes will be reflected to them as well. 30 |

31 |
32 | 39 |
40 |
41 | 42 |
43 |
44 | image 47 |
48 |
Manage Student
49 |

Manage your student's profile here (edit/add/remove). All your 50 | changes will be reflected to them as well. 51 |

52 | 53 |
54 | 61 |
62 |
63 | 64 |
65 |
66 | image 68 |
69 |
Manage Courses
70 |

Manage courses here (edit/add/remove). All your changes will be 71 | reflected in the database. 72 |

73 | 74 |
75 | 82 |
83 |
84 |
85 | 86 |
87 |
88 | 89 |
90 | 91 | 92 | 93 |
94 | 95 | 96 | 97 | <%- include('../Includes/admin_end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/Student/deptSelect.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

STUDENTS

27 |
28 |
29 | ALL 30 | STUDENTS 31 |
32 |
33 |
34 |
35 |
36 |
Student Information
37 |
38 |
39 |
40 |
41 | 43 | 46 |
47 |
48 |
49 |
50 | 52 | 63 |
64 |
65 |
66 |
67 |
68 | 70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | 82 | <%- include('../../Includes/admin_end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/Staff/selectStaff.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

STAFFS

27 |
28 |
29 | ALL 30 | STAFFS 31 |
32 |
33 |
34 |
35 | <%- include('../../Includes/messages') %> 36 |
37 |
Staff Information
38 |
39 |
40 |
41 |
42 | 44 | 47 |
48 |
49 |
50 |
51 | 53 | 64 |
65 |
66 |
67 |
68 |
69 | 71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | 83 | <%- include('../../Includes/admin_end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/infoSettings.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | 3 |
4 |
5 | <%- include('../Includes/admin_nav.ejs') %> 6 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |

ADMIN SETTINGS

20 |
21 |
22 |
23 |
24 | <%- include('../Includes/messages') %> 25 |
26 |
Personal Information
27 |
28 |
29 | 30 |
31 |
32 |
33 |
34 | 37 |
38 |
39 |
40 |
41 |
42 |
43 | 46 |
47 |
48 |
49 |
50 |
51 |
Confirm Password
52 |
53 |
54 |
55 |
56 | 59 |
60 |
61 |
62 |
63 | 65 | 66 |
67 |
68 |
69 | 70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | 78 | <%- include('../Includes/admin_end.ejs') %> -------------------------------------------------------------------------------- /views/Staff/selectClass.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/staff_nav.ejs') %> 3 | 4 | 5 |
6 |
7 |
8 | 9 |
11 | 12 |
13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |

Mark Attendance

22 | <%- include('../Includes/messages') %> 23 |
24 | 25 |
26 |
27 |
28 |
Select Class
29 |
30 |
31 |
32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | <% for(let i=0; i < classData.length; i++) { %> 47 | 48 | 51 | 55 | 58 | 62 | 65 | 66 | 67 | <% } %> 68 | 69 | 70 |
#COURSESEMESTERCLASSSETTINGS
49 | <%= i + 1 %> 50 | 52 | <%= classData[i].name %> (<%= 53 | classData[i].c_id %>) 54 | 56 | <%= classData[i].semester %> 57 | 59 | <%= user.dept_id %>-<%= 60 | classData[i].section %> 61 | <%= btnInfo %> 64 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 80 | 81 |
82 |
83 |
84 | 85 | 86 | 87 | 88 |
89 |
90 | 91 | 92 | <%- include('../Includes/staff_end.ejs') %> -------------------------------------------------------------------------------- /views/Staff/selectClassReport.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/staff_nav.ejs') %> 3 | 4 | 5 |
6 |
7 |
8 | 9 |
11 | 12 |
13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |

Class Report

22 | <%- include('../Includes/messages') %> 23 |
24 | 25 |
26 |
27 |
28 |
Select Class
29 |
30 |
31 |
32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | <% for(let i=0; i < classData.length; i++) { %> 47 | 48 | 51 | 55 | 58 | 62 | 65 | 66 | 67 | <% } %> 68 | 69 | 70 |
#COURSESEMESTERCLASSSETTINGS
49 | <%= i + 1 %> 50 | 52 | <%= classData[i].name %> (<%= 53 | classData[i].c_id %>) 54 | 56 | <%= classData[i].semester %> 57 | 59 | <%= user.dept_id %>-<%= 60 | classData[i].section %> 61 | <%= btnInfo %> 64 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 80 | 81 |
82 |
83 |
84 | 85 | 86 | 87 | 88 |
89 |
90 | 91 | 92 | <%- include('../Includes/staff_end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/Course/getCourse.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

ALL COURSES

27 |
28 |
29 |
30 |
31 | <%- include('../../Includes/messages') %> 32 | 34 |
COURSE INFORMATION
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | <% for(var i=0; i < data.length; i++) { %> 47 | 48 | 49 | 50 | 51 | 53 | 54 | <% } %> 55 | 56 |
#COURSE NAMESEMESTERManage Course
<%= data[i].c_id %><%= data[i].name %><%= data[i].semester %>Settings
57 |
58 | 59 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |
67 |
68 |
69 | 70 | 71 | 72 | 73 |
74 |
75 | 76 |
77 | 78 |
79 | 80 | 83 | 86 | 89 | 90 | 99 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /views/Admin/Department/getDept.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

ALL DEPARTMENTS

27 |
28 |
29 |
30 |
31 | <%- include('../../Includes/messages') %> 32 | 34 |
Department Information
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | <% for(var i=0; i < data.length; i++) { %> 47 | 48 | 49 | 50 | 51 | 53 | 54 | <% } %> 55 | 56 |
#Department IDDepartment NameManage Dept
<%= i + 1 %><%= data[i].dept_id %><%= data[i].d_name %>Settings
57 |
58 | 59 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |
67 |
68 |
69 | 70 | 71 | 72 | 73 |
74 |
75 | 76 |
77 | 78 |
79 | 80 | 83 | 86 | 89 | 90 | 99 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /views/Admin/Class/getClass.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

ALL CLASSES

27 |
28 |
29 |
30 |
31 | <%- include('../../Includes/messages') %> 32 | 34 |
Department Information
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | <% for(let i=0; i < data.length; i++) { %> 48 | 49 | 50 | 51 | 52 | 53 | 55 | 56 | <% } %> 57 | 58 |
#CourseStaffSectionManage Class
<%= data[i].class_id %><%= data[i].c_id %><%= staffData[i] %><%= data[i].section %>Settings
59 |
60 | 61 | 62 | 63 |
64 |
65 |
66 | 67 | 68 |
69 |
70 |
71 | 72 | 73 | 74 | 75 |
76 |
77 | 78 |
79 | 80 |
81 | 82 | 83 | 86 | 89 | 92 | 93 | 102 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /database/cms.sql: -------------------------------------------------------------------------------- 1 | use cumsdbms; 2 | 3 | CREATE TABLE IF NOT EXISTS `admin`( 4 | `admin_id` VARCHAR(36) NOT NULL, 5 | `name` VARCHAR(255) NOT NULL, 6 | `email` VARCHAR(255) NOT NULL UNIQUE, 7 | `password` VARCHAR(255) NOT NULL, 8 | PRIMARY KEY(`admin_id`) 9 | ); 10 | 11 | CREATE TABLE IF NOT EXISTS `course` ( 12 | `c_id` VARCHAR(100) NOT NULL UNIQUE, 13 | `semester` INT NOT NULL, 14 | `name` VARCHAR(255) NOT NULL, 15 | `c_type` VARCHAR(255) NOT NULL, 16 | `credits` INT NOT NULL, 17 | `dept_id` VARCHAR(255) NOT NULL, 18 | PRIMARY KEY (`c_id`) 19 | ); 20 | 21 | CREATE TABLE IF NOT EXISTS `student` ( 22 | `s_id` VARCHAR(36) NOT NULL, 23 | `s_name` VARCHAR(255) NOT NULL, 24 | `gender` VARCHAR(6) NOT NULL, 25 | `dob` DATE NOT NULL, 26 | `email` VARCHAR(255) NOT NULL UNIQUE, 27 | `s_address` VARCHAR(255) NOT NULL, 28 | `contact` VARCHAR(12) NOT NULL, 29 | `password` VARCHAR(255) NOT NULL, 30 | `section` INT NOT NULL, 31 | `joining_date` DATE DEFAULT(CURRENT_DATE), 32 | `dept_id` VARCHAR(255), 33 | PRIMARY KEY (`s_id`) 34 | ); 35 | 36 | CREATE TABLE IF NOT EXISTS `staff` ( 37 | `st_id` VARCHAR(36) NOT NULL, 38 | `st_name` VARCHAR(255) NOT NULL, 39 | `gender` VARCHAR(6) NOT NULL, 40 | `dob` DATE NOT NULL, 41 | `email` VARCHAR(255) NOT NULL UNIQUE, 42 | `st_address` VARCHAR(255) NOT NULL, 43 | `contact` VARCHAR(12) NOT NULL, 44 | `dept_id` VARCHAR(255) NOT NULL, 45 | `password` VARCHAR(255) NOT NULL, 46 | PRIMARY KEY (`st_id`) 47 | ); 48 | 49 | CREATE TABLE IF NOT EXISTS `department` ( 50 | `dept_id` VARCHAR(255) NOT NULL UNIQUE, 51 | `d_name` VARCHAR(255) NOT NULL UNIQUE, 52 | PRIMARY KEY (`dept_id`) 53 | ); 54 | 55 | CREATE TABLE IF NOT EXISTS `fee` ( 56 | `fee_id` INT NOT NULL AUTO_INCREMENT UNIQUE, 57 | `fee_type` VARCHAR(255) NOT NULL, 58 | `reciept_no` BINARY NOT NULL , 59 | `date` DATE NOT NULL UNIQUE, 60 | `s_id` VARCHAR(36) NOT NULL, 61 | PRIMARY KEY (`fee_id`) 62 | ); 63 | 64 | CREATE TABLE IF NOT EXISTS `class` ( 65 | `class_id` INT NOT NULL AUTO_INCREMENT UNIQUE, 66 | `section` INT NOT NULL, 67 | `semester` INT NOT NULL, 68 | `year` DATE DEFAULT(CURRENT_DATE), 69 | `c_id` VARCHAR(100), 70 | `st_id` VARCHAR(36) NOT NULL, 71 | PRIMARY KEY (`class_id`) 72 | ); 73 | 74 | CREATE TABLE IF NOT EXISTS `assignment` ( 75 | `asg_id` INT NOT NULL AUTO_INCREMENT, 76 | `day` DATETIME DEFAULT CURRENT_TIMESTAMP, 77 | `deadline` DATETIME NOT NULL, 78 | `class_id` INT NOT NULL, 79 | PRIMARY KEY (`asg_id`) 80 | ); 81 | 82 | CREATE TABLE IF NOT EXISTS `attendance` ( 83 | `s_id` VARCHAR(36) NOT NULL, 84 | `date` DATE NOT NULL, 85 | `c_id` VARCHAR(100) NOT NULL, 86 | `status` BOOLEAN DEFAULT NULL, 87 | PRIMARY KEY (`s_id`,`c_id`,`date`) 88 | ); 89 | 90 | CREATE TABLE IF NOT EXISTS `marks` ( 91 | `test_id` INT NOT NULL AUTO_INCREMENT, 92 | `tt_marks` INT, 93 | `ob_marks` INT, 94 | `test_type` INT, 95 | `s_id` VARCHAR(36) NOT NULL, 96 | PRIMARY KEY (`test_id`) 97 | ); 98 | 99 | CREATE TABLE IF NOT EXISTS `assignment_submission` ( 100 | `s_id` VARCHAR(36) NOT NULL, 101 | `asg_id` INT NOT NULL, 102 | PRIMARY KEY (`s_id`,`asg_id`) 103 | ); 104 | 105 | CREATE TABLE IF NOT EXISTS `time_table` ( 106 | `c_id` VARCHAR(100), 107 | `st_id` VARCHAR(36) NOT NULL, 108 | `section` INT NOT NULL, 109 | `day` INT NOT NULL, 110 | `start_time` TIME NOT NULL, 111 | `end_time` TIME NOT NULL, 112 | PRIMARY KEY (`c_id`,`section`,`day`) 113 | ); 114 | 115 | ALTER TABLE `course` ADD CONSTRAINT `course_fk0` FOREIGN KEY (`dept_id`) REFERENCES `department`(`dept_id`) on update cascade on delete restrict; 116 | 117 | ALTER TABLE `student` ADD CONSTRAINT `student_fk0` FOREIGN KEY (`dept_id`) REFERENCES `department`(`dept_id`) on update cascade on delete restrict; 118 | 119 | ALTER TABLE `staff` ADD CONSTRAINT `staff_fk0` FOREIGN KEY (`dept_id`) REFERENCES `department`(`dept_id`) on update cascade on delete restrict; 120 | 121 | ALTER TABLE `fee` ADD CONSTRAINT `fee_fk0` FOREIGN KEY (`s_id`) REFERENCES `student`(`s_id`) on update cascade on delete restrict; 122 | 123 | ALTER TABLE `attendance` ADD CONSTRAINT `attendance_fk0` FOREIGN KEY (`s_id`) REFERENCES `student`(`s_id`) on update cascade on delete restrict; 124 | 125 | ALTER TABLE `attendance` ADD CONSTRAINT `attendance_fk1` FOREIGN KEY (`c_id`) REFERENCES `course`(`c_id`) on update cascade on delete restrict; 126 | 127 | ALTER TABLE `class` ADD CONSTRAINT `class_fk0` FOREIGN KEY (`c_id`) REFERENCES `course`(`c_id`) on update cascade on delete restrict; 128 | 129 | ALTER TABLE `class` ADD CONSTRAINT `class_fk1` FOREIGN KEY (`st_id`) REFERENCES `staff`(`st_id`) on update cascade on delete restrict; 130 | 131 | ALTER TABLE `assignment` ADD CONSTRAINT `assignment_fk0` FOREIGN KEY (`class_id`) REFERENCES `class`(`class_id`) on update cascade on delete restrict; 132 | 133 | ALTER TABLE `assignment_submission` ADD CONSTRAINT `assignment_submission_fk0` FOREIGN KEY (`s_id`) REFERENCES `student`(`s_id`) on update cascade on delete restrict; 134 | 135 | ALTER TABLE `assignment_submission` ADD CONSTRAINT `assignment_submission_fk1` FOREIGN KEY (`asg_id`) REFERENCES `assignment`(`asg_id`) on update cascade on delete restrict; 136 | 137 | ALTER TABLE `time_table` ADD CONSTRAINT `time_table_fk0` FOREIGN KEY (`c_id`) REFERENCES `course`(`c_id`) on update cascade on delete restrict; 138 | 139 | ALTER TABLE `time_table` ADD CONSTRAINT `time_table_fk1` FOREIGN KEY (`st_id`) REFERENCES `staff`(`st_id`) on update cascade on delete restrict; 140 | 141 | alter table admin 142 | add resetLink varchar(255) default ''; 143 | 144 | alter table student 145 | add resetLink varchar(255) default ''; 146 | 147 | alter table staff 148 | add resetLink varchar(255) default ''; -------------------------------------------------------------------------------- /views/Student/timetable.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | 3 | <%- include('../Includes/student_nav.ejs') %> 4 | 5 | 6 |
7 |
8 |
9 | 10 |
12 | 13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |

Class Time Table

23 |
24 |
25 |
26 |
27 |
NAME : 28 | <%= studentData.s_name %> || SEMESTER : 29 | <%= semester %> 30 |
31 |
32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | <% for (let i = 0; i < startTimes.length; ++i) {%> 41 | 43 | <%}%> 44 | 45 | 46 | 47 | <% for (let i = 0; i < dayNames.length; ++i) {%> 48 | 49 | 50 | <% for (let j = i * 4; j < i * 4 + startTimes.length; ++j) {%> 51 | 52 | <%}%> 53 | 54 | <%}%> 55 | 56 |
<%=startTimes[i]%> - <%=endTimes[i]%> 42 |
<%=dayNames[i]%><%=timeTableData[j].c_id%>
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Course Details

67 |
68 |
69 |
70 |
71 | <%for(let i = 0; i < classesData.length; ++i){%> 72 |
73 | <%=classesData[i].c_id%> 75 | <%=classesData[i].courseName%> 77 | / <%=classesData[i].staffName%> 78 |
79 | <%}%> 80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | 88 | 89 |
90 |
91 |
92 |
93 |
94 | 95 | <%- include('../Includes/student_end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/Course/deptSelect.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

COURSES

27 |
28 |
29 | ALL 31 | COURSES 32 |
33 |
34 |
35 |
36 |
37 |
Course Information
38 |
39 |
40 |
41 |
42 | 44 | 48 |
49 |
50 |
51 |
52 | 54 | 65 |
66 |
67 |
68 |
69 |
70 | 72 |
73 | 74 |
75 |
76 |
77 | 78 | 79 |
80 |
81 |
82 | 83 | 84 | 85 | 86 |
87 |
88 | 89 |
90 | 91 |
92 | 93 | 94 | 95 | <%- include('../../Includes/admin_end.ejs') %> -------------------------------------------------------------------------------- /views/Student/attendance.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | 3 | <%- include('../Includes/student_nav.ejs') %> 4 | 5 | 6 |
7 |
8 |
9 | 10 |
12 | 13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |

View Attendance

23 |
24 |
25 |
26 |
27 |
NAME : 28 | <%= studentData.s_name %> || SEMESTER : 29 | <%= curSemester %> 30 |
31 |
32 |
33 |
34 |
35 |
36 | <% for (let i = 0; i < monthDates.length; ++i) {%> 37 | 38 | 39 | 40 | 41 | <% for (let j = 0; j < courseData.length; ++j) {%> 42 | 43 | <%}%> 44 | 45 | 46 | 47 | <%for(let j = 0; j < monthDates[i].length; ++j) {%> 48 | 49 | 52 | <% for (let k = 0; k < courseData.length; ++k) {%> 53 | 55 | <%}%> 56 | 57 | <%}%> 58 | 59 |
Days<%=courseData[j].c_id%>
<%=monthDates[i][j].monthName%> 50 | <%=monthDates[i][j].dayNumber%> 51 | <%= isPresent[i][j][k]==undefined?'-':isPresent[i][j][k].status%> 54 |
60 | <%}%> 61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |

Course Details

71 |
72 |
73 |
74 |
75 | <%for(let i = 0; i < courseData.length; ++i){%> 76 |
77 | <%=courseData[i].c_id%> 79 | <%=courseData[i].name%> 81 |
82 | <%}%> 83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | 91 | 92 |
93 |
94 |
95 |
96 |
97 | 98 | <%- include('../Includes/student_end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/Staff/getStaff.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

ALL STAFFS

27 |
28 |
29 |
30 |
31 | <%- include('../../Includes/messages') %> 32 | 34 |
STAFF INFORMATION
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | <% for(var i=0; i < data.length; i++) { %> 48 | 49 | 52 | 55 | 58 | 61 | 64 | 65 | <% } %> 66 | 67 |
#Staff EmailNameDeptManage Staff
50 | <%= i + 1 %> 51 | 53 | <%= data[i].email %> 54 | 56 | <%= data[i].st_name %> 57 | 59 | <%= data[i].dept_id %> 60 | Settings 63 |
68 |
69 | 70 | 71 | 72 |
73 |
74 |
75 | 76 | 77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | 85 | 86 | 89 | 92 | 95 | 96 | 105 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /views/Admin/Student/getStudent.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

ALL STUDENTS

27 |
28 |
29 |
30 |
31 | <%- include('../../Includes/messages') %> 32 | 34 |
STUDENT INFORMATION
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | <% for(var i=0; i < data.length; i++) { %> 48 | 49 | 52 | 55 | 58 | 61 | 64 | 65 | <% } %> 66 | 67 |
#Student EmailNameClassManage Student
50 | <%= i + 1 %> 51 | 53 | <%= data[i].email %> 54 | 56 | <%= data[i].s_name %> 57 | 59 | <%= data[i].dept_id + ' ' + data[i].section %> 60 | Settings 63 |
68 |
69 | 70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 80 |
81 | 82 | 85 | 88 | 91 | 92 | 101 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /views/Admin/Class/addClass.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |

ADD NEW CLASS

27 |
28 |
29 |
30 |
31 | <%- include('../../Includes/messages') %> 32 |
33 |
Class information
34 |
35 |
36 |
37 |
38 | 41 | 49 |
50 |
51 |
52 | 53 |
54 |
55 |
56 | 58 | 66 |
67 |
68 |
69 |
70 | 72 | 75 |
76 |
77 | 78 |
79 |
80 |
81 | 83 |
84 | 85 | 86 |
87 |
88 |
89 | 90 | 91 |
92 |
93 |
94 | 95 | 96 | 97 | 98 |
99 |
100 | 101 |
102 | 103 |
104 | 105 | 106 | <%- include('../../Includes/admin_end.ejs') %> -------------------------------------------------------------------------------- /views/Admin/Department/setDept.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CMS NSIT 8 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 |
27 | 28 | <%- include('../../Includes/admin_nav.ejs') %> 29 | 30 |
31 |
32 | 33 |
34 |
36 | 37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |

DEPARTMENT SETTINGS

46 |
47 | 51 |
52 |
53 |
54 |
55 |
Department Information
56 |
57 |
58 |
59 |
60 | 62 | 66 |
67 |
68 |
69 |
70 | 74 |
75 | 77 |

78 | <%= id %> 79 |

80 |
81 |
82 |
83 |
84 | 85 |
86 |
87 | 89 |
90 | 91 | 92 |
93 |
94 |
95 | 96 | 97 |
98 |
99 |
100 | 101 | 102 | 103 | 104 |
105 |
106 | 107 |
108 | 109 |
110 | 111 | 112 | <%- include('../../Includes/admin_end.ejs') %> -------------------------------------------------------------------------------- /views/Staff/selectClassAttendance.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../Includes/begin.ejs') %> 2 | <%- include('../Includes/staff_nav.ejs') %> 3 | 4 | 5 |
6 |
7 |
8 | 9 |
11 | 12 |
13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |

Mark Attendance

22 | <%- include('../Includes/messages') %> 23 |
24 | 25 |
26 |
27 |
28 |
Select Class
29 | 30 |
31 |
32 |
33 |
34 |
35 |
36 | 39 |
40 | 42 |
43 |
44 |
45 |
46 | 50 | 66 |
67 |
68 | 69 |
70 | 72 | 73 |
74 |
75 | 76 |
77 | 78 |
79 |
80 |
81 |
82 | 83 | 84 |
85 |
86 |
87 | 88 | 89 | 90 | 91 |
92 |
93 |
94 |
95 | 98 | 101 | 104 | 105 | 110 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /views/Admin/Course/addCourse.ejs: -------------------------------------------------------------------------------- 1 | <%- include('../../Includes/begin.ejs') %> 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 | <%- include('../../Includes/admin_nav.ejs') %> 10 | 11 |
12 |
13 | 14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |

ADD NEW COURSE

26 |
27 |
28 |
29 |
30 | 31 |
32 |
Course Information
33 |
34 |
35 |
36 |
37 | 39 | 42 |
43 |
44 |
45 |
46 | 48 | 51 |
52 |
53 |
54 |
55 |
56 |
57 | 59 | 67 |
68 |
69 |
70 |
71 |
72 |
73 | 75 | 77 | 78 |
79 |
80 |
81 |
82 | 84 | 89 |
90 |
91 |
92 |
93 |
94 | 96 |
97 | 98 | 99 |
100 |
101 |
102 | 103 | 104 |
105 |
106 |
107 | 108 | 109 | 110 | 111 |
112 |
113 | 114 |
115 | 116 |
117 | 118 | 119 | 120 | <%- include('../../Includes/admin_end.ejs') %> --------------------------------------------------------------------------------