Skip to content

Commit

Permalink
allotment pages added
Browse files Browse the repository at this point in the history
  • Loading branch information
basil-reji committed Apr 30, 2023
1 parent cea19ca commit 971f9bd
Show file tree
Hide file tree
Showing 6 changed files with 613 additions and 86 deletions.
48 changes: 48 additions & 0 deletions controller/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,54 @@ const candidate = {
data.lpk_id = data.lpk_id.substring(0, 8);
}

if (String(data.lpk_id.length) == 8 && data.lpk_id.includes("LPK1")) {
db.get()
.collection(collections.CANDIDATES)
.findOne({
"id": data.lpk_id
})
.then((response) => {
// console.log(response)
if (response) {
if(data.email.startsWith(" ")){
data.email = data.email.substring(1);
}
if(data.email.endsWith(" ")){
data.email = data.email.substring(0, 8);
}
if(response.email == data.email) {
resolve(response)
}else if(response.other_email.original == data.email){
resolve(response)
}else if(response.other_email.corrected == data.email){
resolve(response)
}else if(response.other_email.hackerearth == data.email){
resolve(response)
}else{
reject("Please enter the correct email address.")
}
} else {
reject("We regret to inform you that we are unable to proceed with your application to the next round. We wish you all the best for your future endeavors.")
}
}).catch((error) => {
reject(error)
})
} else {
reject("Please enter a valid Launchpad Kerala ID.")
}
})
},

view: (data) => {
return new Promise(async (resolve, reject) => {

if(data.lpk_id.startsWith(" ")){
data.lpk_id = data.lpk_id.substring(1);
}
if(data.lpk_id.endsWith(" ")){
data.lpk_id = data.lpk_id.substring(0, 8);
}

if (String(data.lpk_id.length) == 8 && data.lpk_id.includes("LPK1")) {
db.get()
.collection(collections.CANDIDATES)
Expand Down
211 changes: 125 additions & 86 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,116 +8,155 @@ var app_name = 'Launchpad Kerala'

/* GET home page. */
router.get('/', (req, res, next) => {
let user = req.user
// console.log(req.user);
if (user && user.permissions.admin) {
res.redirect('/admin/')
} else {
res.render('index', {
title: app_name,
home_page: true
});
}
let user = req.user
// console.log(req.user);
if (user && user.permissions.admin) {
res.redirect('/admin/')
} else {
res.render('index', {
title: app_name,
home_page: true
});
}
});

router.get('/contact', (req, res, next) => {
let user = req.user;
res.render('pages/contact', {
title: `Test Page | ${app_name}`,
user
});
let user = req.user;
res.render('pages/contact', {
title: `Test Page | ${app_name}`,
user
});
});

router.post('/contact', (req, res, next) => {
let user = req.user;
if (user) {
req.body.user = user.id;
} else {
req.body.user = null;
}
console.log(req.body)
controller.contact.message(req.body)
.then((response) => {
res.send(
{
response: "acknowledged",
status: true
}
);
})
.catch((error) => {
res.send(
{
error,
status: false
}
);
})
let user = req.user;
if (user) {
req.body.user = user.id;
} else {
req.body.user = null;
}
// console.log(req.body)
controller.contact.message(req.body)
.then((response) => {
res.send(
{
response: "acknowledged",
status: true
}
);
})
.catch((error) => {
res.send(
{
error,
status: false
}
);
})
});

router.get('/updates', function (req, res, next) {
res.render('updates',
{
title: `Updates | ${app_name}`,
page_head: 'News & Updates',
page_nav_name: 'Updates',
breadcrumbs: true,
updates_page: true
});
res.render('updates',
{
title: `Updates | ${app_name}`,
page_head: 'News & Updates',
page_nav_name: 'Updates',
breadcrumbs: true,
updates_page: true
});
});


router.get('/privacy-policy', function (req, res, next) {
res.render('pages/privacy_policy',
{
title: `User Pricay Policy | ${app_name}`,
page_head: 'User Pricay Policy',
page_nav_name: 'pricay policy'
});
res.render('pages/privacy_policy',
{
title: `User Pricay Policy | ${app_name}`,
page_head: 'User Pricay Policy',
page_nav_name: 'pricay policy'
});
});

router.get('/results', function (req, res, next) {
res.render('pages/results',
{
title: `Results | ${app_name}`,
page_head: 'Results',
page_nav_name: 'Results',
reults_page: true
});
res.render('pages/results',
{
title: `Results | ${app_name}`,
page_head: 'Results',
page_nav_name: 'Results',
reults_page: true
});
});

router.get('/results/view', function (req, res, next) {
let message = req.flash('message');
res.render('pages/result',
{
title: `Results | ${app_name}`,
page_head: 'Results',
page_nav_name: 'Results',
reults_page: true,
no_preloader: true,
message,
});
let message = req.flash('message');
res.render('pages/result',
{
title: `Results | ${app_name}`,
page_head: 'Results',
page_nav_name: 'Results',
reults_page: true,
no_preloader: true,
message,
});
});

router.post('/results/view', function (req, res, next) {
// console.log(req.body);
controller.candidate.viewResult(req.body)
.then((candidate) => {
// res.redirect('/results/view');
res.render('pages/view_result',
controller.candidate.view(req.body)
.then((candidate) => {
res.render('pages/view_result',
{
title: `View Result | ${app_name}`,
page_head: 'Results',
page_nav_name: 'Results',
reults_page: true,
candidate
});
})
.catch((error) => {
req.flash('message', error);
res.redirect('/results/view');
})
});

router.get('/allotment', function (req, res, next) {
res.render('pages/allotment',
{
title: `Allotment | ${app_name}`,
page_head: 'Allotment',
page_nav_name: 'Allotment',
allotment_page: true
});
});

router.get('/allotment/apply', function (req, res, next) {
let message = req.flash('message');
res.render('pages/allotment/apply',
{
title: `Allotment Application| ${app_name}`,
page_head: 'Allotment',
page_nav_name: 'Allotment',
allotment_page: true,
message
});
});

router.post('/allotment/apply', function (req, res, next) {
res.render('pages/allotment/apply',
{
title: `Allotment Application | ${app_name}`,
page_head: 'Allotment',
page_nav_name: 'Allotment',
allotment_page: true
});
});

router.get('/allotment/recruiters', function (req, res, next) {
res.render('pages/allotment/recruiters',
{
title: `View Result |${app_name}`,
page_head: 'Results',
page_nav_name: 'Results',
reults_page: true,
candidate
title: `Allotment | ${app_name}`,
page_head: 'Allotment',
page_nav_name: 'Allotment',
allotment_page: true
});
})
.catch((error) => {
// console.log(error);
req.flash('message', error);
res.redirect('/results/view');
})
});

module.exports = router;
76 changes: 76 additions & 0 deletions views/admin/dashboard.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,82 @@
</div>

</div>
<div class="row mt-5">

<div class="col-12 col-sm-6 col-md-4 col-xl-3">

<div class="card info-card">
<div class="card-body">
<h5 class="card-title">Total<span> | Test Attendees</span></h5>

<div class="d-flex align-items-center">
<div class="card-icon blue-card rounded-circle d-flex align-items-center justify-content-center">
<i class="bi bi-people"></i>
</div>
<div class="ps-3">
<h6>2509</h6>
</div>
</div>
</div>
</div>

</div>
<div class="col-12 col-sm-6 col-md-4 col-xl-3">

<div class="card info-card">
<div class="card-body">
<h5 class="card-title">Analytical<span> | Test Attendees</span></h5>

<div class="d-flex align-items-center">
<div class="card-icon orange-card rounded-circle d-flex align-items-center justify-content-center">
<i class="bi bi-people"></i>
</div>
<div class="ps-3">
<h6>2484</h6>
</div>
</div>
</div>
</div>

</div>
<div class="col-12 col-sm-6 col-md-4 col-xl-3">

<div class="card info-card">
<div class="card-body">
<h5 class="card-title">Programming<span> | Test Attendees</h5>

<div class="d-flex align-items-center">
<div class="card-icon organge-card rounded-circle d-flex align-items-center justify-content-center">
<i class="bi bi-people"></i>
</div>
<div class="ps-3">
<h6>2106</h6>
</div>
</div>
</div>
</div>

</div>
<div class="col-12 col-sm-6 col-md-4 col-xl-3">

<div class="card info-card">
<div class="card-body">
<h5 class="card-title">shortlisted Candidates</h5>

<div class="d-flex align-items-center">
<div class="card-icon green-card rounded-circle d-flex align-items-center justify-content-center">
<i class="bi bi-people"></i>
</div>
<div class="ps-3">
<h6>1000</h6>
</div>
</div>
</div>
</div>

</div>

</div>
</div>

</div>
Expand Down
Loading

0 comments on commit 971f9bd

Please sign in to comment.