Web-Based Trainee Tracking System Report
Web-Based Trainee Tracking System Report
Vocational Training
Ramgarh-825101
Under Supervision of
ACKNOWLEDGEMENT
I am grateful to Prof. Arvind Kumar Mishra, Director, CSIR - CIMFR and Dr. Dilip
Kumbhakar, chief scientist, and head, HRD CIMFR, Dhanbad for permitting us to do a project
at this institute.
At the very outset, I would like to express my sincere gratitude to Dr. Shankhajit Mitra (Project
Planning and Monitoring/ GST Cell) for his support. He took his time off from work and
explained about the practical aspects of the project. His valuable guidance has helped me to
complete this project and make it full proof success. His suggestions and instructions have
served as the major contributor towards the completion of the project. This work would be
incomplete without his involvement.
I would also express my gratitude to the HRD department of CSIR-CIMFR,DHANBAD who
were very helpful throughout this training period. Last but not the least, I would like to extend
my sincere thanks to my family members, without whose support this would not have been
possible.
3
4
CONTENT
[Link] TOPICS PAGE NO
01 INTRODUCTION 5
02 OBJECTIVE 6
07 REFERENCE 137
5
INTRODUCTION
A "Trainee Status Check" website typically refers to a website or online platform that allows
individuals or trainees to check their current status or progress in a training program or course. These
websites are often used by educational institutions, training organizations, or companies to provide
trainees with an easy way to track their training progress and access relevant information.
The specific features and functionalities of a Trainee Status Check website can vary depending on the
organization or institution implementing it. However, some common features you might find on such
a website include:
1. Status Check: Trainees can check their status by using the college name or their provided reference
numbers.
2. Forms: There are two forms available for training and dissertations, where users can fill out the
form according to the given guidelines.
3. About Page: The website may have an about page that provides details about the institute or
organization.
4. Contact Information: The website should provide contact information for trainees to reach out with
any inquiries or concerns.
6
2. OBJECTIVE
The objectives of a Trainee Status Check website may vary depending on the specific
requirements of the organization or training program. However, here are some common
objectives that such a website may aim to achieve:
Status Tracking: The primary objective of the website is to provide trainees with a
convenient way to check their training status.
Easy Application Process: The website should allow students to easily apply for training
programs through the platform.
Administrative Access: The administrator should be able to access the admin panel to
review, approve, reject, or manage pending applications.
7
LANGUAGES:
HTML
CSS
JavaScript
MySQL
TECHNOLOGIES:
VS Code
Xampp
8
HTML
HTML stands for Hyper Text Markup Language
HTML is the standard markup language for creating Web pages
HTML describes the structure of a Web page
HTML consists of a series of elements
HTML elements tell the browser how to display the content
HTML elements label pieces of content such as “this is a heading”, “this is a paragraph”,
“this is a link”, etc.
EX:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
“Hypertext” refers to links that connect web pages to one another, either within a single
website or between websites. Links are a fundamental aspect of the Web. By uploading
content to the Internet and linking it to pages created by other people, you become an active
participant in the World Wide Web.
HTML uses “markup” to annotate text, images, and other content for display in a Web
browser. HTML markup includes special “elements” such as <head>, <title>, <body>,
<header>, <footer>, <article>, <section>, <p>, <div>, <span>, <img>, <aside>, <audio>,
<canvas>, <datalist>, <details>, <embed>, <nav>, <search>, <output>, <progress>, <video>,
<ul>, <ol>, <li> and many others.
An HTML element is set off from other text in a document by “tags”, which consist of the
element name surrounded by “<” and “>”. The name of an element inside a tag is case-
insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the
<title> tag can be written as <Title>, <TITLE>, or in any other way. However, the
convention and recommended practice is to write tags in lowercase
9
CSS
CSS is the language we use to style an HTML [Link] describes how HTML elements
should be [Link] describes how HTML elements should be displayed.
EX:
<!DOCTYPE>
<html>
<head>
<style>
h1{
color:white;
background-color:red;
padding:5px;
}
p{
color:blue;
}
</style>
</head>
<body>
<h1>Write Your First CSS Example</h1>
<p>This is Paragraph.</p>
</body>
</html>
10
JAVASCRIPT
EX: <script>
[Link](“Hello JavaScript by JavaScript”);
</script>
11
[Link]
Overview of [Link]
1. Web Servers:
o [Link] is frequently used to build web servers and APIs due to its efficiency
and scalability.
2. Real-Time Applications:
o It is ideal for real-time applications such as chat applications, online gaming,
collaboration tools, and live streaming.
12
3. Microservices:
o [Link] supports the microservices architecture, allowing developers to build
modular and independently deployable services.
4. Command-Line Tools:
o Many command-line tools and scripts are built with [Link] due to its
flexibility and ease of use.
5. IoT Applications:
o [Link] is also used in Internet of Things (IoT) applications due to its
lightweight nature and event-driven architecture.
13
MYSQL
Relational Database Management System: MySQL follows the relational model for
managing data. It organizes data into tables with rows and columns, allowing for efficient
storage and retrieval of data.
Open-Source: MySQL is open-source software, which means it is free to use and can be
modified and distributed by anyone. It is developed and maintained by Oracle Corporation.
SQL Language Support: MySQL supports the SQL (Structured Query Language) for
querying, modifying, and managing the data stored in its databases. SQL provides a
standardized way to interact with relational databases.
Data Security: MySQL provides various security features, including user authentication,
access control, and encryption, to ensure the confidentiality and integrity of data.
Scalability and Performance: MySQL is designed to handle large amounts of data and high
traffic loads. It supports features like indexing, caching, and replication to optimize
performance and scalability.
Integration and Connectivity: MySQL offers connectors and APIs for various programming
languages, making it easy to integrate with different applications and frameworks.
14
• Version: ^3.1.10
• Description: EJS is a templating language that enables you to generate HTML with
plain JavaScript. It's commonly used for embedding JavaScript code within HTML
files to create dynamic web pages.
• ejs-mate:
• Version: ^4.0.0
• Description: EJS Mate is an extension for EJS that provides layout and partial
support, making it easier to create reusable templates and maintain consistent
structure across different web pages.
• email-check:
• Version: ^1.1.0
• Description: This library validates email addresses by checking their format and
verifying the existence of the domain's mail exchange (MX) records, ensuring that the
email address can potentially receive emails.
• express:
• Version: ^4.19.2
• Description: Express is a widely-used, fast, and minimalist web framework for
[Link]. It simplifies the process of building robust web applications and APIs by
providing a range of features out of the box.
• fs (File System):
• Version: ^0.0.1-security
• Description: This is a placeholder for the [Link] 'fs' (file system) module, which
provides an API for interacting with the file system to read, write, and manipulate
files and directories.
• joi:
• Version: ^17.13.1
• Description: Joi is a powerful validation library for JavaScript objects. It allows you
to define schemas for your data and validate them, ensuring the data meets the
required format and constraints.
• method-override:
• Version: ^3.0.0
• Description: Method-override is an Express middleware that allows you to use HTTP
methods like PUT and DELETE where they are not supported by the client. It enables
method overriding using query parameters or custom headers.
15
• multer:
• Version: ^1.4.5-lts.1
• Description: Multer is a middleware for handling multipart/form-data, primarily
used for file uploads in Express applications. It makes handling file uploads
straightforward and supports various storage options.
• mysql2:
• Version: ^3.9.8
• Description: MySQL2 is a MySQL client for [Link]. It provides a fast and efficient
way to interact with MySQL databases, supporting both callback and promise-based
APIs for query execution.
• nodemailer:
• Version: ^6.9.13
• Description: Nodemailer is a module for [Link] applications that facilitates sending
emails. It supports various transport methods, including SMTP, and makes it easy to
integrate email functionality into your applications.
16
File Structure
[Link]
[Link]([Link]());
[Link]([Link]({ extended: true }));
[Link](methodOverride("_method"));
// [Link]("/uploads", [Link]("./public/uploads"));
// [Link]([Link](__dirname, "./public/[Link]"));
});
[Link](password);
[Link](results);
if (password == results[0].password) {
[Link](`/admin`);
} else {
alert("wrong password");
[Link]("/login");
}
}
);
});
[Link]("/select", (req, res) => {
let selectedEmails = [Link];
let mentorName = [Link];
[Link]([Link]);
let emailsArray = [Link](selectedEmails)
? selectedEmails
: [selectedEmails];
[Link]("Selected Emails:", selectedEmails);
[Link]("Selected mentor:", mentorName);
[Link]((email) => {
[Link](
"UPDATE student SET requestedTeacher = ? , applicationStatus =
'stageTwo' WHERE email = ?",
[mentorName, email],
(error, results) => {
if (error) [Link](200).send("error while udateing data" + error);
}
);
});
[Link]("/student");
});
[Link]("/sendEmail", (req, res) => {
[Link](
"select * from student where applicationStatus = 'selected' and sendEmail
= 'false'",
(err, results) => {
if (err) throw err;
let data = results;
[Link]("[Link]", { data });
}
);
});
[Link]("/sendEmail", (req, res) => {
let { email, mentoremail } = [Link];
[Link](email);
[Link](mentoremail);
let mailOptions = {
22
from: "madhavkumarchas@[Link]",
to: [Link],
subject: "conformation email of selection of internship in cimfr",
text: `your mentor email is ${[Link]} contact for more
info`,
};
[Link](mailOptions, (error, info) => {
if (error) [Link]("error in sending email");
[Link](
"update student set sendEmail = 'true' where email = ?",
[[Link]],
(error, results) => {
if (error) [Link]("database error");
[Link]("/sendEmail");
}
);
});
});
[Link]("/student/delete/:email", (req, res) => {
let { email } = [Link];
[Link](
"UPDATE student SET applicationStatus = 'rejected' WHERE email = ?",
[email],
(error, results) => {
if (error) {
[Link](error);
}
{
[Link](results);
[Link]("/student");
}
}
);
});
[Link]("/loginMentor", (req, res) => {
[Link]("loginMentor");
});
[Link]("/loginMentor", (req, res) => {
let { email, password } = [Link];
[Link](
"select password from mentor where email = ?",
[email],
(error, results) => {
if (error) [Link]("database error");
[Link](password);
[Link](results);
if (password == results[0].password) {
[Link](`/inmentor/${email}`);
23
} else {
alert("wrong password");
[Link]("/login");
}
}
);
});
[Link]("/student/:email", async (req, res) => {
let { email } = [Link];
[Link](email);
[Link]("select * from student where email=?", [email], (error, results) =>
{
if (error) {
[Link](error);
}
{
let student = results[0];
[Link](results);
[Link](student);
[Link]("[Link]", { student });
}
});
});
if (error) {
[Link](error);
[Link](
"delete from mentor where email=?",
[[Link]],
(error) => {
if (error) [Link]("database eror and transporter error");
}
);
[Link]("email error");
} else {
[Link]("Email sent: %s", [Link]);
[Link]("Message ID: %s", [Link]);
[Link]([Link]);
[Link]("email sent");
}
});
[Link](results);
[Link]("/mentor");
}
);
});
[Link]("/mentor/delete", (req, res) => {
[Link]([Link]);
let mentorEmail = [Link];
[Link](
"DELETE FROM mentor WHERE email=?",
[mentorEmail],
(error, results) => {
if (error) [Link]("error in database");
[Link]("/mentor");
}
);
});
[Link](
"update student set selectedMentorName=?, requestedTeacher = ? ,
applicationStatus = 'selected', where email= ?",
[email, null, id],
(error, results) => {
if (error) [Link]("database error");
}
);
[Link](`/inmentor/${email}`);
25
});
[Link]("/inmentor/delete/:id/:email", (req, res) => {
let { id, email } = [Link];
[Link](
"update student set applicationStatus = 'new', requestedTeacher = ? where
email = ?",
[null, id],
(error, results) => {
if (error) [Link]("database error");
[Link](`/inmentor/${email}`);
}
);
});
[Link](port, () => {
[Link](`Server running at [Link]
});
[Link]
const mysql = require("mysql2");
const db = [Link]({
host: "localhost",
user: "root",
password: "Ravi@123",
database: "mydb",
26
multipleStatements: true,
});
[Link]((err) => {
if (err) {
throw err;
}
[Link]("Connected to database");
});
[Link] = { db };
[Link]
const db = [Link]({
host: "localhost",
user: "root",
password: "Ravi@123",
database: "mydb",
multipleStatements: true,
});
[Link]((err) => {
if (err) {
throw err;
}
[Link]("Connected to database");
});
[Link] = { db };
[Link]
[Link] = { transporter };
27
Views Folder
all [Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Student Applications</title>
<!-- Bootstrap CSS -->
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
body {
padding: 20px;
}
.table th,
.table td {
border: 1px solid #dee2e6;
padding: 0.75rem;
text-align: left;
}
.table th {
background-color: #f2f2f2;
}
.btn-custom {
background-color: #4caf50;
color: white;
border: none;
cursor: pointer;
}
.btn-custom:hover {
background-color: #45a049;
}
.card {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mt-3">
28
<div class="container">
<a class="navbar-brand" href="../admin">Dashboard</a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="../sendEmail">Email</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../student">New Applications</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../mentor">Mentor List</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="row">
<div class="col-12">
<h2 class="mt-4">All Applications</h2>
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead class="thead-light">
<tr>
<th>Application Status</th>
<th>Full Name</th>
<th>Email</th>
<th>Branch</th>
<th>College Name</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% [Link](student => { %>
<tr>
29
Output
30
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Student Details</title>
<!-- Bootstrap CSS -->
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
body {
margin: 20px;
}
.student-details {
border: 1px solid #ccc;
padding: 20px;
border-radius: 10px;
max-width: 800px;
margin: auto;
}
.student-details img {
width: 150px;
height: 150px;
border-radius: 50%;
display: block;
margin: 0 auto 10px;
}
.student-details h2 {
text-align: center;
}
.student-details p {
margin: 5px 0;
}
</style>
</head>
<body>
<div class="container">
<div class="student-details card">
<h5 class="card-title">Application NO. <%=[Link]
%></h5>
<div class="card-body">
<h2 class="card-title"><%= [Link] %></h2>
31
<div class="text-center">
<img src="../uploads/<%= [Link]( [Link]
).toString().replace("frontend\\public\\uploads\\", "") %>"
alt="Student Photograph" class="img-fluid mb-3" />
</div>
<div class="row">
<div class="col-md-6">
<p><strong>Father's Name:</strong> <%= [Link] %></p>
<p>
<strong>Date of Birth:</strong> <%=
[Link]() %>
</p>
<p><strong>Email:</strong> <%= [Link] %></p>
<p><strong>Gender:</strong> <%= [Link] %></p>
<p><strong>Category:</strong> <%= [Link] %></p>
<p>
<strong>Physically Disabled:</strong> <%=
[Link] %>
</p>
<p>
<strong>Certificate No:</strong> <%= [Link] %>
</p>
<p>
<strong>Mobile No:</strong> <%= parseInt([Link]) %>
</p>
<p>
<strong>Alternate Mobile No:</strong> <%=
parseInt([Link]) %>
</p>
<p>
<strong>Correspondence Address:</strong> <%=
[Link] %>
</p>
<p>
<strong>Permanent Address:</strong> <%=
[Link]
%>
</p>
<p><strong>Photo Id:</strong> <%= [Link] %></p>
</div>
<div class="col-md-6">
<p><strong>Marks (10th):</strong> <%= student.marks10th %></p>
<p><strong>Marks (12th):</strong> <%= student.marks12th %></p>
<p><strong>Percentage:</strong> <%= [Link] %></p>
<p><strong>Year and Sem:</strong> <%= [Link] %></p>
<p><strong>Branch:</strong> <%= [Link] %></p>
<p><strong>College Name:</strong> <%= [Link] %></p>
32
<p><strong>Caste Certificate:</strong></p>
<img src="../uploads/<%= [Link]( [Link]
).toString().replace("frontend\\public\\uploads\\", "") %>"
alt="Caste Certificate" class="img-fluid mb-3" />
<p><strong>Physically Disabled Certificate:</strong></p>
<img src="../uploads/<%= [Link](
[Link]
).toString().replace("frontend\\public\\uploads\\", "") %>"
alt="Physically Disabled Certificate" class="img-fluid mb-3" />
</div>
<p>
<strong>LOR:</strong>
<a
href='../uploads/<%= [Link](
[Link]
).toString().replace("frontend\\public\\uploads\\", "") %>'
target="_blank"
class="btn btn-primary btn-sm"
>View PDF</a
>
</p>
<p>
<strong>Documents:</strong>
<a
href='../uploads/<%= [Link](
[Link]
).toString().replace("frontend\\public\\uploads\\", "") %>'
target="_blank"
33
Output
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Student Mentor Table</title>
<!-- Include Bootstrap CSS -->
<link
rel="stylesheet"
href="[Link]
[Link]"
/>
</head>
<body>
<div class="container mt-5">
<div class="card">
<div class="card-header bg-primary text-white">
<h1 class="mb-0">Student Mentor Table</h1>
</div>
<div class="card-body">
35
<script
src="[Link]
/script>
</body>
</html>
Output
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Application Portal</title>
<link
rel="stylesheet"
href="[Link]
css"
/>
<link
href="[Link]
isplay=swap"
rel="stylesheet"
/>
<style>
body {
font-family: "Roboto", sans-serif;
37
font-weight: 400;
line-height: 1.6;
background-color: #f8f9fa;
}
.header {
background-color: #ffffff;
padding: 20px;
border-radius: 10px;
margin-top: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
text-align: center;
}
.header img {
max-width: 150px;
margin-bottom: 20px;
}
.header-content h1 {
font-size: 2.5rem;
font-weight: 700;
color: #333;
}
.navbar-brand {
font-weight: 700;
color: #4caf50 !important;
}
.navbar-nav .nav-link {
font-weight: 500;
font-size: 1.5rem;
color: #ffffff !important;
}
.navbar-nav .nav-link:hover {
color: #4caf50 !important;
}
.navbar-toggler {
border-color: #4caf50;
}
.navbar-toggler-icon {
color: #4caf50;
}
38
.card {
border: none;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: box-shadow 0.2s;
background-color: #ffffff;
text-decoration: none;
color: inherit;
}
.card:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
.card-title {
color: #4caf50;
font-weight: 700;
font-size: 1.25rem;
}
.card-text {
color: #333;
font-weight: 500;
font-size: 2rem;
}
.footer {
background-color: #343a40;
color: white;
padding: 20px;
text-align: center;
margin-top: 40px;
}
.container {
margin-top: 40px;
}
.display-4 {
font-size: 2.5rem;
font-weight: 700;
}
</style>
</head>
<body>
<div class="container">
<img src="/images/[Link]" alt="CSIR-CIMFR" class="img-fluid" />
<header class="header">
39
<div class="header-content">
<h1 class="display-4">Application Portal</h1>
</div>
</header>
<footer class="footer">
<div class="container">
<p>© 2024 Student Mentor App. All rights reserved.</p>
</div>
</footer>
</div>
<script src="[Link]
<script
src="[Link]
></script>
<script
src="[Link]
ript>
</body>
</html>
41
Output
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Login Page</title>
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
body {
background-color: #f0f2f5;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
font-size: 1.2rem; /* Increased font size */
}
42
.card {
border: none;
border-radius: 1rem;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
padding: 2rem;
}
.card-header {
background-color: #fff;
border-bottom: none;
text-align: center;
font-size: 2rem; /* Increased font size */
margin-bottom: 1.5rem;
}
.card-body {
padding: 1.5rem;
}
.form-group label {
font-weight: bold;
}
.btn-primary {
background-color: #007bff;
border: none;
transition: background-color 0.3s;
}
.btn-primary:hover {
background-color: #0056b3;
}
.btn-secondary {
background-color: #6c757d;
border: none;
transition: background-color 0.3s;
}
.btn-secondary:hover {
background-color: #5a6268;
}
.text-center {
margin-top: 1rem;
43
<script src="[Link]
<script
src="[Link]
></script>
44
<script
src="[Link]
/script>
</body>
</html>
Output
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Login Page</title>
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
body {
background-color: #f0f2f5;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
45
.card {
border: none;
border-radius: 1rem;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
padding: 2rem;
}
.card-header {
background-color: #fff;
border-bottom: none;
text-align: center;
font-size: 2rem; /* Increased font size */
margin-bottom: 1.5rem;
}
.card-body {
padding: 1.5rem;
}
.form-group label {
font-weight: bold;
}
.btn-primary {
background-color: #007bff;
border: none;
transition: background-color 0.3s;
}
.btn-primary:hover {
background-color: #0056b3;
}
.btn-secondary {
background-color: #6c757d;
border: none;
transition: background-color 0.3s;
}
.btn-secondary:hover {
background-color: #5a6268;
}
46
.text-center {
margin-top: 1rem;
font-size: 1rem; /* Increased font size */
}
</style>
</head>
<body>
<div class="card">
<div class="card-header">
<h2>Login As Mentor</h2>
</div>
<div class="card-body">
<form method="POST" action="/loginMentor">
<div class="form-group">
<label for="email">Email address</label>
<input
type="email"
class="form-control"
id="email"
name="email"
placeholder="Enter email"
/>
</div>
<div class="form-group">
<label for="password">Password</label>
<input
type="password"
class="form-control"
id="password"
name="password"
placeholder="Password"
/>
</div>
<button type="submit" class="btn btn-primary btn-
block">Login</button>
</form>
</div>
</div>
<script src="[Link]
<script
src="[Link]
></script>
<script
src="[Link]
/script>
</body>
</html>
47
Output
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Student Applications</title>
<!-- Bootstrap CSS -->
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
body {
padding: 20px;
}
.table th,
.table td {
border: 1px solid #dee2e6;
padding: 0.75rem;
text-align: left;
}
.table th {
background-color: #f2f2f2;
}
.btn-custom {
48
background-color: #4caf50;
color: white;
border: none;
cursor: pointer;
}
.btn-custom:hover {
background-color: #45a049;
}
.card {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-12">
<h2 class="mt-4">Student Applications</h2>
<div class="card">
<div class="card-body">
<div class="form-group">
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead class="thead-light">
<tr>
<th>Application Status</th>
<th>Full Name</th>
<th>Email</th>
<th>Branch</th>
<th>College Name</th>
<th>View Application</th>
<th>Accept</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<% [Link](student => { %>
<tr>
<a
href="../student/<%= [Link] %>"
class="btn btn-custom btn-sm"
>View Application</a
>
</td>
<td>
<a
href="./accept/<%= [Link]
%>/<%=teacherEmail%>"
class="btn btn-custom btn-sm"
>Accept</a
>
</td>
<td>
<a
href="./delete/<%= [Link]
%>/<%=teacherEmail%>"
class="btn btn-custom btn-sm"
><i class="fas fa-trash-alt"></i>Delete</a
>
</td>
</tr>
<% }) %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Output
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mentors List</title>
<!-- Bootstrap CSS -->
<link
href="[Link]
css"
rel="stylesheet"
/>
</head>
<body>
<div class="container mt-5">
<h1 class="text-center mb-4">Mentors List</h1>
<table class="table table-striped table-bordered">
<thead class="thead-dark">
<tr>
<th>Name</th>
<th>Department</th>
<th>Email</th>
<th>Mobile No</th>
<th>Action</th>
51
</tr>
</thead>
<tbody>
<% [Link](function(mentor) { %>
<tr>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td>
<form
action="/mentor/delete?_method=DELETE"
method="POST"
class="delete-form"
>
<input
type="hidden"
name="mentorEmail"
value="<%= [Link] %>"
required
/>
<button type="submit" class="btn btn-danger btn-sm">
<i class="fas fa-trash-alt"></i> Delete
</button>
</form>
</td>
</tr>
<% }); %>
</tbody>
</table>
<h2 class="text-center mt-5 mb-4">Add New Mentor</h2>
<form
action="/mentor/new"
method="POST"
class="needs-validation"
novalidate
>
<div class="form-group">
<label for="name">Name:</label>
<input
type="text"
class="form-control"
id="name"
name="name"
required
/>
<div class="invalid-feedback">Please enter the mentor's name.</div>
</div>
52
<div class="form-group">
<label for="dept">Department:</label>
<input
type="text"
class="form-control"
id="dept"
name="dept"
required
/>
<div class="invalid-feedback">Please enter the department.</div>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input
type="email"
class="form-control"
id="email"
name="email"
required
/>
<div class="invalid-feedback">
Please enter a valid email address.
</div>
</div>
<div class="form-group">
<label for="mobileNo">Mobile No:</label>
<input
type="tel"
class="form-control"
id="mobileNo"
name="mobileNo"
required
/>
<div class="invalid-feedback">
Please enter a valid mobile number.
</div>
</div>
<button type="submit" class="btn btn-primary">Add New</button>
</form>
</div>
<!-- Bootstrap JS and dependencies -->
<script src="[Link]
<script
src="[Link]
></script>
<script
src="[Link]
ript>
53
Output
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Student Applications</title>
<!-- Bootstrap CSS -->
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
body {
padding: 20px;
}
.table th,
.table td {
border: 1px solid #dee2e6;
padding: 0.75rem;
54
text-align: left;
}
.table th {
background-color: #f2f2f2;
}
.btn-custom {
background-color: #4caf50;
color: white;
border: none;
cursor: pointer;
}
.btn-custom:hover {
background-color: #45a049;
}
.card {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mt-3">
<div class="container">
<a class="navbar-brand" href="../admin">Dashboard</a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="../sendEmail">Email</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../student">New Applications</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../mentor">Mentor List</a>
</li>
</ul>
</div>
55
</div>
</nav>
<div class="row">
<div class="col-12">
<h2 class="mt-4">Student Applications</h2>
<div class="card">
<div class="card-body">
<form action="/select" method="POST">
<div class="form-group">
<label for="mentorSelect">Select Mentor:</label>
<select
id="mentorSelect"
name="mentorName"
class="form-control"
>
<% [Link](mentor => { %>
<option value="<%= [Link] %>">
<%= [Link] %>
</option>
<% }) %>
</select>
</div>
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead class="thead-light">
<tr>
<th>Select</th>
<th>Application Status</th>
<th>Full Name</th>
<th>Email</th>
<th>Branch</th>
<th>College Name</th>
<th>Action</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<% [Link](student => { %>
<tr>
<td>
<input
type="checkbox"
name="selectedEmails"
value="<%= [Link] %>"
/>
</td>
<td><%= [Link] %></td>
56
</html>
Output
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Student Applications</title>
<!-- Bootstrap CSS -->
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
body {
padding: 20px;
}
.table th,
.table td {
border: 1px solid #dee2e6;
padding: 0.75rem;
text-align: left;
}
.table th {
background-color: #f2f2f2;
58
}
.btn-custom {
background-color: #4caf50;
color: white;
border: none;
cursor: pointer;
}
.btn-custom:hover {
background-color: #45a049;
}
.card {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mt-3">
<div class="container">
<a class="navbar-brand" href="../admin">Dashboard</a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="../sendEmail">Email</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../student">New Applications</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../mentor">Mentor List</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="row">
<div class="col-12">
59
</tr>
<% }) %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Output
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Student Applications</title>
<!-- Bootstrap CSS -->
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
body {
padding: 20px;
}
.table th,
.table td {
border: 1px solid #dee2e6;
padding: 0.75rem;
text-align: left;
}
.table th {
background-color: #f2f2f2;
}
.btn-custom {
61
background-color: #4caf50;
color: white;
border: none;
cursor: pointer;
}
.btn-custom:hover {
background-color: #45a049;
}
.card {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mt-3">
<div class="container">
<a class="navbar-brand" href="../admin">Dashboard</a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="../sendEmail">Email</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../student">New Applications</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../mentor">Mentor List</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="row">
<div class="col-12">
<h2 class="mt-4">Rejected Applications</h2>
<div class="card">
62
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead class="thead-light">
<tr>
<th>Application Status</th>
<th>Full Name</th>
<th>Email</th>
<th>Branch</th>
<th>College Name</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% [Link](student => { %>
<tr>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td>
<a
href="../student/<%= [Link] %>"
class="btn btn-custom btn-sm"
>View Application</a
>
</td>
</tr>
<% }) %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Output
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Student Applications</title>
<!-- Bootstrap CSS -->
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
body {
padding: 20px;
}
.table th,
.table td {
border: 1px solid #dee2e6;
padding: 0.75rem;
text-align: left;
}
.table th {
background-color: #f2f2f2;
}
.btn-custom {
64
background-color: #4caf50;
color: white;
border: none;
cursor: pointer;
}
.btn-custom:hover {
background-color: #45a049;
}
.card {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mt-3">
<div class="container">
<a class="navbar-brand" href="../admin">Dashboard</a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="../sendEmail">Email</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../student">New Applications</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../mentor">Mentor List</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="row">
<div class="col-12">
<h2 class="mt-4">Selected Applications</h2>
<div class="card">
65
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead class="thead-light">
<tr>
<th>Application Status</th>
<th>Full Name</th>
<th>Email</th>
<th>Branch</th>
<th>College Name</th>
<th>Mentor</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% [Link]((student, index) => { %>
<tr>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= mentorName[index].name%></td>
<td>
<a
href="../student/<%= [Link] %>"
class="btn btn-custom btn-sm"
>View Application</a
>
</td>
</tr>
<% }) %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Output
CSS file
[Link]
body {
background-color: #f8f9fa;
}
.card {
margin-top: 50px;
}
[Link]
body {
font-family: "Roboto", sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
color: #333;
}
.header {
position: relative;
67
width: 100%;
overflow: hidden;
}
.header img {
width: 100%;
height: auto;
object-fit: cover;
}
.header-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
text-align: center;
background: rgba(0, 0, 0, 0.5);
padding: 20px;
border-radius: 8px;
}
.header-content h1 {
margin: 0;
font-size: 2.5em;
}
.footer {
background-color: #333;
color: white;
text-align: center;
padding: 10px 0;
position: relative;
bottom: 0;
width: 100%;
}
.footer p {
margin: 0;
}
68
USER FORM
[Link]
const mysql = require("mysql2");
const express = require("express");
const app = express();
const multer = require("multer");
const path = require("path");
const {con} = require("./sql")
const { validateStudent, usedEmail } = require("./middleware");
[Link]([Link]());
[Link]([Link]({ extended: true }));
// [Link]("view engine", "ejs");
[Link]("views", [Link](__dirname, "views"));
// [Link]("ejs", ejsMate);
// [Link](methodOverride("_method"));
// [Link]([Link]())
[Link]([Link]([Link](__dirname, "/public")));
// [Link](fields);
// });
[Link](
"/",
[Link]([
{ name: "disabledCertificate", maxCount: 1 },
{ name: "casteCertificate", maxCount: 1 },
{ name: "photograph", maxCount: 1 },
{ name: "lor", maxCount: 1 },
{ name: "documents", maxCount: 1 },
]),
validateStudent,
usedEmail,
async (req, res) => {
// [Link]("validated");
[Link]("entered");
let newStudent = [Link];
if ([Link] == undefined || [Link] == null)
{
[Link] = "notGiven";
}
if ([Link]) {
if ([Link]) {
let url = [Link][0].path;
[Link] = url;
} else {
[Link] = "notfound";
}
if ([Link]) {
let url = [Link][0].path;
[Link] = url;
} else {
[Link] = "notfound";
}
if ([Link]) {
let url = [Link][0].path;
[Link] = url;
} else {
[Link] = "notfound";
}
if ([Link]) {
let url = [Link][0].path;
70
[Link] = url;
} else {
[Link] = "notfound";
}
if ([Link]) {
let url = [Link][0].path;
[Link] = url;
} else {
[Link] = "notfound";
}
} else {
[Link] = "notfound";
[Link] = "notfound";
[Link] = "notfound";
[Link] = "notfound";
[Link] = "notfound";
}
let statement = `INSERT INTO student (fullname, fathername, dob, email,
gender, category, physicallyDisabled, certificateNo, mobileNo,
alternatemobileNo, correspondenceAddress, permanentAddress, marks10th,
marks12th, percentage, yearAndSem, branch, collegeName, collegeType, duration,
achievements, otherQualifications, researchTraining, domicile, photoId,
physicallyDisabliedCertificate, casteCertificate, photograph, lor,
documents, dateOfApply) VALUES
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`;
[Link](
statement,
[
[Link],
[Link],
[Link],
[Link],
[Link],
[Link],
[Link],
[Link],
[Link]([Link]),
[Link]([Link]),
[Link],
[Link],
[Link](newStudent.marks10th),
[Link](newStudent.marks12th),
[Link]([Link]),
[Link],
[Link],
[Link],
[Link],
71
[Link],
[Link],
[Link],
[Link],
[Link],
[Link],
[Link]([Link]),
[Link]([Link]),
[Link]([Link]),
[Link]([Link]),
[Link]([Link]),
[Link](),
],
(error, results) => {
if (error) throw error;
[Link]("success");
[Link](results);
}
);
[Link](newStudent);
[Link]([Link](__dirname, "./views/[Link]"));
}
);
[Link](8080, () => {
[Link]("app started listening");
});
[Link]
const JoiBase = require("joi");
const joi = [Link]((joi) => ({
type: "string",
base: [Link](),
messages: {
"[Link]": "{{#label}} should be less than or equal to 100",
"[Link]": "{{#label}} should be a number",
"[Link]": "{{#label}} should not be negative",
},
rules: {
maxNum: {
validate(value, helpers, args, options) {
const num = Number(value);
if (isNaN(num)) {
return [Link]("[Link]");
}
72
[Link]
const { studentSchema } = require("./joiSchema");
[Link]
const mysql = require('mysql2');
});
[Link](function (err) {
if (err) throw err;
[Link]("connected");
});
[Link] = {con};
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Application Form</title>
<link
href="[Link]
[Link]"
rel="stylesheet"
/>
<style>
.form-container {
margin: 20px;
}
.[Link] {
margin-bottom: 15px;
}
.form-check-inline {
margin-right: 10px;
}
.button {
margin-top: 20px;
display: flex;
justify-content: center;
gap: 4rem;
}
body {
background: #f9f9f9;
display: flex;
75
justify-content: center;
align-items: center;
flex-direction: column;
margin: 0;
}
body::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 400px;
height: 500px;
background: url("./images/[Link]") no-repeat center center;
background-size: contain;
opacity: 0.2;
transform: translate(-50%, -50%);
z-index: 0;
pointer-events: none;
}
form {
background-color: #ffffff;
border: 5px solid #ccc;
min-width: 800px;
padding: 3rem;
margin: auto;
}
.preview-section {
display: none;
background-color: #ffffff;
border: 5px solid #ccc;
min-width: 800px;
padding: 3rem;
margin: auto;
margin-top: 20px;
}
.preview-image {
max-width: 100px;
max-height: 100px;
}
/* .image-container {
display: flex;
flex-wrap: wrap;
}
76
.image-container img {
max-width: 100px;
max-height: 100px;
margin: 10px;
} */
img {
max-width: 100%;
height: auto;
}
div[id^="imageContainer"] {
border: 1px solid #ccc;
padding: 10px;
margin: 10px 0;
}
.error {
font-weight: 700;
display: block;
color: #f00;
font-size: 14px;
}
#error-message {
display: none;
color: red;
font-size: 14px;
font-weight: 700;
}
.star {
color: #f00;
}
</style>
</head>
<body>
<div class="container">
<img src="./images/[Link]" alt="Cimfr logo" width="100%" />
</div>
<br />
<div class="container form-container">
<form
id="formvalidation"
name="formvalidation"
novalidate
action="./"
method="post"
enctype="multipart/form-data"
>
<h3 align="center"><u> Vocational Training Form </u></h3>
77
<br />
<br />
<p>
<b
>*VOCATIONAL TRAINING PROGRAMME APPLICATION FORM: Under-graduate
Courses in [Link]/B.E/Equivalent degree</b
><br />
Vocational training will be provided to students for a duration of
4(four) weeks to 8(eight) weeks only<br />
During (1) Summer Session: 01 May to 30 June (2) Winter Session: 01
December to 31 January next year<br />
<b
>Last Date to Apply:<br />
1> Summer Internship: 15th April<br />
2> Winter Internship: 15th November<br
/></b>
For Details Kindly Please visit <b>ACADEMICS</b> menu in the
<b>CSIR-CIMFR</b> website <a>([Link])</a><br />
<b
>*Note: A registration fee of RS.1000/- have to be deposited at
CSIR-CIMFR account by the selected candidate<br />
before the start of the training period.</b
>
</p>
<br />
<div id="inputElements">
<!-- fullName input -->
<div class="form-group row">
<label for="fullName" class="col-sm-4 col-form-label"
>Full Name of Trainee<b class="star">*</b>:</label
>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="fullName"
placeholder="Enter your full name"
name="fullName"
value=""
required
/>
<span id="nameError" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="fatherName" class="col-sm-4 col-form-label"
>Father's Name<b class="star">*</b>:</label
>
78
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="fatherName"
placeholder="Enter father's name"
value=""
name="fatherName"
required
/>
<span id="nameError1" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="dob" class="col-sm-4 col-form-label"
>Date of Birth<b class="star">*</b>:</label
>
<div class="col-sm-8">
<input
type="date"
class="form-control"
id="dob"
value=""
required
name="dob"
/>
</div>
</div>
<div class="form-group row">
<label for="email" class="col-sm-4 col-form-label"
>Email<b class="star">*</b>:</label
>
<div class="col-sm-8">
<input
type="email"
class="form-control"
id="email"
placeholder="Enter your email"
value=""
required
name="email"
/>
<span id="nameError2" class="error"></span>
<p id="error-message">Please enter a valid email address.</p>
</div>
</div>
<div class="form-group row">
<label for="gender" class="col-sm-4 col-form-label"
79
>Gender<b class="star">*</b>:</label
>
<div class="col-sm-8 d-flex align-items-center">
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="gender"
id="male"
value="male"
required
/>
<label class="form-check-label" for="male">Male</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="gender"
id="female"
value="female"
required
/>
<label class="form-check-label" for="female">Female</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="gender"
id="othersgender"
value="others"
required
/>
<label class="form-check-label" for="othersgender"
>Others</label
>
</div>
</div>
</div>
<div class="form-group row">
<label for="category" class="col-sm-4 col-form-label"
>Category<b class="star">*</b>:</label
>
<div class="col-sm-8">
<select class="form-control" id="category" name="category">
<option value="Select" required>Select</option>
<option value="sc">SC</option>
80
<option value="st">ST</option>
<option value="obc">OBC</option>
<option value="ews">EWS</option>
<option value="general">General</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label"
>Physically Disabled<b class="star">*</b>:</label
>
<div class="col-sm-8 d-flex align-items-center">
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="disability"
id="yes"
value="yes"
required
/>
<label class="form-check-label" for="yes">Yes</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="disability"
id="no"
value="no"
checked
required
/>
<label class="form-check-label" for="no">No</label>
</div>
</div>
</div>
<div class="form-group row">
<label for="certificateNo" class="col-sm-4 col-form-label"
>Certificate No.<b class="star">*</b></label
>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="certificateNo"
placeholder="Enter certificate number"
disabled
81
value=""
default="notGiven"
required
name="certificateNo"
/>
<span id="nameError3" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="mobile" class="col-sm-4 col-form-label"
>Mobile No<b class="star">*</b>:</label
>
<div class="col-sm-8">
<input
type="number"
class="form-control"
id="mobile"
placeholder="Enter your mobile number"
value=""
required
name="mobile"
/>
<span id="nameError4" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="alternateMobile" class="col-sm-4 col-form-label">
Alternate No./Guardian No.<b class="star">*</b></label
>
<div class="col-sm-8">
<input
type="number"
class="form-control"
id="alternateMobile"
placeholder="Enter alternate mobile number"
value=""
required
name="alternateMobileNo"
/>
<span id="nameError5" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="correspondenceAddress" class="col-sm-4 col-form-label"
>Correspondence Address<b class="star">*</b>:</label
>
<div class="col-sm-8">
<input
82
type="text"
class="form-control"
id="correspondenceAddress"
placeholder="Enter correspondence address"
value=""
required
name="correspondenceAddress"
/>
<span id="nameError6" class="error"></span>
</div>
</div>
<div class="form-group row">
<div class="col-sm-4"></div>
<div class="col-sm-8">
<div class="form-check">
<input
class="form-check-input"
type="checkbox"
id="sameAddressCheckbox"
/>
<label class="form-check-label" for="sameAddressCheckbox"
>Same as Correspondence Address</label
>
</div>
</div>
</div>
<div class="form-group row">
<label for="permanentAddress" class="col-sm-4 col-form-label"
>Permanent Address<b class="star">*</b>:</label
>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="permanentAddress"
placeholder="Enter permanent address"
value=""
required
name="permanentAddress"
/>
<span id="nameError7" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="marks10th" class="col-sm-4 col-form-label"
>Percentage in 10th<b class="star">*</b>:</label
>
<div class="col-sm-8">
83
<input
type="number"
class="form-control"
id="marks10th"
placeholder=" Enter marks in percentage "
value=""
required
name="marks10th"
/>
<span id="nameError8" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="marks12th" class="col-sm-4 col-form-label"
>Percentage in 12th /Equivalent Degree<b class="star">*</b
>:</label
>
<div class="col-sm-8">
<input
type="number"
class="form-control"
id="marks12th"
placeholder="Enter marks in percentage"
value=""
required
name="marks12th"
/>
<span id="nameError9" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="percentage" class="col-sm-4 col-form-label"
>Percentage in Btech/B.E/Equivalent Degree<b class="star">*</b
>:</label
>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="percentage"
placeholder="Enter marks in percentage"
value=""
required
name="percentage"
/>
<span id="nameError10" class="error"></span>
</div>
</div>
84
name="collegename"
/>
<span id="nameError13" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="college" class="col-sm-4 col-form-label"
>Weather the college/Institute/Universities<b class="star">*</b
>:</label
>
<div class="col-sm-8 d-flex align-items-center">
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="college"
id="[Link]"
value="govt"
required
/>
<label class="form-check-label" for="govt"
>Government Academic Institution</label
>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="college"
id="[Link]"
value="non-govt"
required
/>
<label class="form-check-label" for="other"
>Non-Government Academic Institution</label
>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="college"
id="others"
value="other"
required
/>
<label class="form-check-label" for="other">Others</label
><input type="text" id="otherCollege" disabled />
86
</div>
</div>
</div>
<div class="form-group row">
<label for="Duration" class="col-sm-4 col-form-label">
Duration of Training requested (in months)<b class="star">*</b
>:</label
>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="Duration"
placeholder="Enter Duration Less than or equal to 2 Months"
value="1"
required
name="duration"
/>
<span id="nameError14" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="Prize" class="col-sm-4 col-form-label"
>Achievements (if any)/Prize/Medal/Other Award:</label
>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="Prize"
placeholder="Enter
Achievements/Scholarship/Prizes/Award/Distinction or Honor Won"
value=""
name="achievements"
/>
<span id="nameError15" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="Details" class="col-sm-4 col-form-label"
>Other Qualification(If Any):</label
>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="Details"
placeholder="Enter Other Qualification Details "
87
value=""
name="otherQualifications"
/>
<span id="nameError16" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="Research" class="col-sm-4 col-form-label"
>Research Training(If Any):</label
>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="Research"
placeholder="Enter Reaearch Training Details"
value=""
name="research"
/>
<span id="nameError17" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="Domicile" class="col-sm-4 col-form-label"
>Trainee Domicile(Rural/Urban)<b class="star">*</b>:</label
>
<div class="col-sm-8 d-flex align-items-center">
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="Domicile"
value="Rural"
required
/>
<label class="form-check-label" for="govt">RURAL</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="Domicile"
value="Urban"
required
/>
<label class="form-check-label" for="other">URBAN</label>
</div>
</div>
88
</div>
<div class="form-group row">
<label for="PhotoID" class="col-sm-4 col-form-label"
>Photo ID NUMBER<b class="star">*</b>:</label
>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="PhotoID"
placeholder="Aadhar Number/PAN/Voter Id/Passport"
value=""
required
name="photoId"
/>
<span id="nameError18" class="error"></span>
</div>
</div>
<div class="form-group row">
<label for="fileInput1" class="col-sm-4 col-form-label"
>Physically Disabled Certificate:</label
>
<div class="col-sm-8">
<input
type="file"
class="form-control-file"
id="fileInput1"
accept="image/*"
name="disabledCertificate"
/>
<div id="error1" style="color: red"></div>
</div>
</div>
<div class="form-group row">
<label for="fileInput2" class="col-sm-4 col-form-label"
>Caste certificate:</label
>
<div class="col-sm-8">
<input
type="file"
class="form-control-file"
id="fileInput2"
accept="image/*"
name="casteCertificate"
/>
<div id="error2" style="color: red"></div>
</div>
</div>
89
id="fileInput5"
accept=".pdf"
required
name="documents"
/>
<div id="error5" style="color: red"></div>
</div>
</div>
<div class="button">
<button type="button" class="btn btn-primary" id="previewButton">
Preview
</button>
<script src="[Link]
<script
src="[Link]
></script>
<script
src="[Link]
ript>
<script src="[Link]
validate/1.19.5/[Link]"></script>
<script
src="[Link]
pt>
<script
src="[Link]
t>
<script src="./js/form_validation.js"></script>
<script src="[Link]
<script src="./js/[Link]"></script>
</body>
</html>
92
93
form_validation.js
$(document).ready(function () {
$("#formvalidation").submit(function (event) {
// Prevent the form from submitting
// [Link]();
} else {
$("#nameError6").text("");
}
$("#nameError14").text("");
}
// // Example: Check if input field of collegeName of trainee is empty
if ([Link] > 0) {
let file = [Link][0];
// caste certificate
[Link]("");
if ([Link] > 0) {
let file = [Link][0];
if ([Link] > 0) {
let file = [Link][0];
if ([Link] > 0) {
let file = [Link][0];
99
if ([Link] > 0) {
let file = [Link][0];
if (!isValid) {
[Link]();
// alert("Please fill out all required fields."); // Alert if the form
is not valid
}
});
});
[Link]
document
.getElementById("sameAddressCheckbox")
.addEventListener("change", function () {
if ([Link]) {
[Link]("permanentAddress").value =
[Link]("correspondenceAddress").value;
} else {
[Link]("permanentAddress").value = "";
}
});
100
function getCheckedRadios(name) {
let radios = [Link](name);
return null;
}
toggleCertificateInput();
const others = [Link]("others");
const govt = [Link]("[Link]");
const nongovt = [Link]("[Link]");
const otherCollege = [Link]("otherCollege");
const toggleCollege = () => {
[Link] = ![Link];
};
[Link]("change", toggleCollege);
[Link]("change", toggleCollege);
[Link]("change", toggleCollege);
toggleCollege();
[Link]("DOMContentLoaded", function () {
const previewButton = [Link]("previewButton");
[Link]("click", function () {
let fullName = [Link]("fullName").value;
let fatherName = [Link]("fatherName").value;
let dob = [Link]("dob").value;
let email = [Link]("email").value;
let gender = getCheckedRadios("gender");
let category = [Link]("category").value;
let disability = getCheckedRadios("disability");
let certificateNo = [Link]("certificateNo").value;
101
// content
let previewContent = `
<p><strong>Full Name of Trainee:</strong> ${fullName}</p>
<p><strong>Father's Name:</strong> ${fatherName}</p>
<p><strong>Date of Birth:</strong> ${dob}</p>
<p><strong>Email:</strong> ${email}</p>
<p><strong>Gender:</strong> ${gender}</p>
<p><strong>Category:</strong> ${category}</p>
<p><strong>Disability:</strong> ${disability}</p>
<p><strong>Certificate No.:</strong> ${certificateNo}</p>
<p><strong>Mobile No:</strong> ${mobile}</p>
<p><strong>Alternate No./Guardian No.:</strong> ${alternateMobile}</p>
<p><strong>Correspondence Address:</strong> ${correspondenceAddress}</p>
<p><strong>Permanent Address:</strong> ${permanentAddress}</p>
<p><strong>Percentage in 10th:</strong> ${marks10th}</p>
<p><strong>Percentage in 12th:</strong> ${marks12th}</p>
<p><strong>Percentage in
Btech/B.E/Equivalent Degree:</strong> ${percentage}</p>
<p><strong> Year and Semester of BTECH/B.E/Equivalent
Degree:</strong> ${year}</p>
<p><strong>Branch/Stream:</strong> ${branch}</p>
<p><strong>Name of the College/Universities:</strong> ${collegename}</p>
<p><strong>Weather the college/Institute/Universities:</strong>
${collegeType}</p>
<p><strong>Duration of Training requested (in
months):</strong> ${Duration}</p>
<p><strong>Achievements (if any)/Prize/Medal/Other
Award:</strong> ${Prize}</p>
102
[Link]("formPreview").innerHTML =
previewContent + [Link]("formPreview").innerHTML;
// [Link]("smart").[Link] = 'block';/
[Link]("previewSection").[Link] = "block";
[Link]("inputElements").[Link] = "none";
});
});
[Link](file);
[Link] = function (e) {
[Link] = [Link];
};
}
}
[Link]("change", previewSelectedImage1);
[Link]("change", previewSelectedImage4);
[Link]
{
"dependencies": {
"ejs": "^3.1.10",
"ejs-mate": "^4.0.0",
"email-check": "^1.1.0",
"express": "^4.19.2",
"fs": "^0.0.1-security",
"joi": "^17.13.1",
"method-override": "^3.0.0",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.9.8",
"nodemailer": "^6.9.13",
"nodemon": "^3.1.1"
}
}
Setup
REFERENCE
W3 SCHOOL
JAVA POINT
BOOTSTRAP