Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a supportpage, sorted table function, etc. #219

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 33 additions & 16 deletions app/controllers/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function filterApplications(req, res, cb) {
ID: bioApp.userstudentid,
FirstName: bioApp.userfname,
LastName: bioApp.userlname,
PhoneNumber: bioApp.phonenumber,
'BIO GPA': bioApp.programgpa,
Concentration: bioApp.major,
'Expected Graduation': bioApp.expectedGraduationSemester + ' ' + bioApp.expectedGraduationYear,
Expand All @@ -144,7 +145,7 @@ function filterApplications(req, res, cb) {
appArray.push(bioJson);
});

fields = ['ID', 'FirstName', 'LastName', 'BIO GPA', 'Concentration',
fields = ['ID', 'FirstName', 'LastName', 'PhoneNumber', 'BIO GPA', 'Concentration',
'Expected Graduation', 'Semester', 'Year'];

cb(null, {
Expand All @@ -170,6 +171,7 @@ function filterApplications(req, res, cb) {
ID: itecApp.userstudentid,
FirstName: itecApp.userfname,
LastName: itecApp.userlname,
PhoneNumber: itecApp.phonenumber,
'ITEC GPA': itecApp.itecgpa,
Concentration: itecApp.major,
'Expected Graduation': itecApp.expectedGraduationSemester + ' ' + itecApp.expectedGraduationYear,
Expand All @@ -180,7 +182,7 @@ function filterApplications(req, res, cb) {
appArray.push(itecJson);
});

fields = ['ID', 'FirstName', 'LastName', 'ITEC GPA', 'Concentration',
fields = ['ID', 'FirstName', 'LastName', 'PhoneNumber', 'ITEC GPA', 'Concentration',
'Expected Graduation', 'Programming', 'Semester', 'Year'];

cb(null, {
Expand Down Expand Up @@ -223,6 +225,7 @@ module.exports.filterApplications = function (req, res) {
}
}


function write(fileName, csv, req, res) {
fs.writeFile(fileName, csv, function (err) {
if (err) {
Expand Down Expand Up @@ -270,13 +273,19 @@ module.exports.getSpecificBioApplication = function (req, res) {
if (err) throw err;
Document.getBioDocumentsForUser(bioApp.useremail, function (incomingDocuments) {
documents = incomingDocuments;
res.render('applicationdetails.ejs', {
application: bioApp,
documents: documents,
user: req.user,
successMessage: req.flash('success'),
failureMessage: req.flash('failure')
});
User.findOne({_id: req.user._id}, function(err, user) {
if (err) {
throw err;
}
res.render('applicationdetails.ejs', {
application: bioApp,
documents: documents,
user: user,
// userPhoneNumber: user.local.phone,
successMessage: req.flash('success'),
failureMessage: req.flash('failure')
});
})
});
});
};
Expand All @@ -294,13 +303,19 @@ module.exports.getSpecificItecApplication = function (req, res) {
if (err) throw err;
Document.getItecDocumentsForUser(itecApp.useremail, function (incomingDocuments) {
documents = incomingDocuments;
res.render('applicationdetails.ejs', {
application: itecApp,
documents: documents,
user: req.user,
successMessage: req.flash('success'),
failureMessage: req.flash('failure')
});
User.findOne({_id: req.user._id}, function(err, user) {
if (err) {
throw err;
}
res.render('applicationdetails.ejs', {
application: itecApp,
documents: documents,
user: user,
// userPhoneNumber: user.local.phone,
successMessage: req.flash('success'),
failureMessage: req.flash('failure')
});
})
});
});
}
Expand Down Expand Up @@ -687,6 +702,7 @@ module.exports.postItecApplication = function (req, res) {
itecapp.userstudentid = req.user.studentid;
itecapp.userfname = req.user.fname;
itecapp.userlname = req.user.lname;
itecapp.userphone = req.user.phone;
itecapp.useraddress = req.user.address;
itecapp.usercity = req.user.city;
itecapp.userstate = req.user.state;
Expand Down Expand Up @@ -719,6 +735,7 @@ module.exports.postBioApplication = function (req, res) {
bioapp.userstudentid = req.user.studentid;
bioapp.userfname = req.user.fname;
bioapp.userlname = req.user.lname;
bioapp.userphone = req.user.phone;
bioapp.useraddress = req.user.address;
bioapp.usercity = req.user.city;
bioapp.userstate = req.user.state;
Expand Down
41 changes: 28 additions & 13 deletions app/controllers/editApplications.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,53 @@
- Logic for routes: getEditBio, getEditItec, updateBioApp, updateItecApp
- Loads the user's submitted bio/itec application and then updates
*/

var User = require('../models/user');
var Bio = require('../models/bio');
var Itec = require('../models/itec');

module.exports.getEditBio = function(req, res) {
Bio.getUsersBioApp(req.user.email, function(foundBioApp) {
res.render('editbio', {
application: foundBioApp,
user : req.user,
successMessage: req.flash('success'),
failureMessage: req.flash('failure')
});
User.findOne({_id: req.user._id}, function(err, user) {
res.render('editbio', {
application: foundBioApp,
user : user,
successMessage: req.flash('success'),
failureMessage: req.flash('failure')
});
})
});
}

module.exports.getEditItec = function(req, res) {
Itec.getUsersItecApp(req.user.email, function(foundItecApp) {
res.render('editItec', {
application: foundItecApp,
user : req.user,
successMessage: req.flash('success'),
failureMessage: req.flash('failure')
});
User.findOne({_id: req.user._id}, function(err, user) {
res.render('editItec', {
application: foundItecApp,
user : user,
successMessage: req.flash('success'),
failureMessage: req.flash('failure')
});
})
});
}


module.exports.updateAppStatusItec = function (req, res){
newItecapp.applicationstatus = oldItecApp.applicationstatusItec;
}

module.exports.updateAppStatusBio = function (req, res){
newBioapp.applicationstatus = oldBioApp.applicationstatusBio;
}

module.exports.updateBioApp = function(req, res) {

var newBioapp = new Bio(req.body);
newBioapp.useremail = req.user.email;
newBioapp.userstudentid = req.user.studentid;
newBioapp.userfname = req.user.fname;
newBioapp.userlname = req.user.lname;
newBioapp.userphone = req.user.phone;
newBioapp.useraddress = req.user.address;
newBioapp.usercity = req.user.city;
newBioapp.userstate = req.user.state;
Expand Down Expand Up @@ -68,6 +82,7 @@ module.exports.updateItecApp = function(req, res) {
newItecapp.userstudentid = req.user.studentid;
newItecapp.userfname = req.user.fname;
newItecapp.userlname = req.user.lname;
newItecapp.userphone = req.user.phone;
newItecapp.useraddress = req.user.address;
newItecapp.usercity = req.user.city;
newItecapp.userstate = req.user.state;
Expand Down
8 changes: 6 additions & 2 deletions app/controllers/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ module.exports.exportExport = function (req, res) {
ID: bioApp.userstudentid,
FirstName: bioApp.userfname,
LastName: bioApp.userlname,
PhoneNumber: bioApp.userphone,
'BIO GPA': bioApp.programgpa,
Concentration: bioApp.major,
'Expected Graduation': bioApp.expectedGraduationSemester + ' ' + bioApp.expectedGraduationYear,
Expand All @@ -133,7 +134,7 @@ module.exports.exportExport = function (req, res) {
appArray.push(bioJson);
});

fields = ['ID', 'FirstName', 'LastName', 'BIO GPA', 'Concentration',
fields = ['ID', 'FirstName', 'LastName', 'PhoneNumber', 'BIO GPA', 'Concentration',
'Expected Graduation', 'Semester', 'Year'];

var csv = json2csv({ data: appArray, fields: fields });
Expand All @@ -155,6 +156,7 @@ module.exports.exportExport = function (req, res) {
ID: itecApp.userstudentid,
FirstName: itecApp.userfname,
LastName: itecApp.userlname,
PhoneNumber: itecApp.userphone,
'ITEC GPA': itecApp.itecgpa,
Concentration: itecApp.major,
'Expected Graduation': itecApp.expectedGraduationSemester + ' ' + itecApp.expectedGraduationYear,
Expand All @@ -165,7 +167,7 @@ module.exports.exportExport = function (req, res) {
appArray.push(itecJson);
});

fields = ['ID', 'FirstName', 'LastName', 'ITEC GPA', 'Concentration',
fields = ['ID', 'FirstName', 'LastName', 'PhoneNumber', 'ITEC GPA', 'Concentration',
'Expected Graduation', 'Programming', 'Semester', 'Year'];

var csv = json2csv({ data: appArray, fields: fields });
Expand Down Expand Up @@ -531,6 +533,7 @@ module.exports.postItecApplication = function (req, res) {
itecapp.userstudentid = req.user.studentid;
itecapp.userfname = req.user.fname;
itecapp.userlname = req.user.lname;
itecapp.userphone = req.user.phone;
itecapp.useraddress = req.user.address;
itecapp.usercity = req.user.city;
itecapp.userstate = req.user.state;
Expand Down Expand Up @@ -563,6 +566,7 @@ module.exports.postBioApplication = function (req, res) {
bioapp.userstudentid = req.user.studentid;
bioapp.userfname = req.user.fname;
bioapp.userlname = req.user.lname;
bioapp.userphone = req.user.phone;
bioapp.useraddress = req.user.address;
bioapp.usercity = req.user.city;
bioapp.userstate = req.user.state;
Expand Down
18 changes: 18 additions & 0 deletions app/controllers/support.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Controller functions containing the logic for the support routes
Authors : Matthew Rosario
*/

/*
HTTP Req: GET
URL: '/support'
*/
module.exports.getSupport = function(req, res) {
if (req.isAuthenticated()) {
res.render('support.ejs', {
user: req.user
});
} else {
res.render('support.ejs');
}
};
6 changes: 5 additions & 1 deletion app/models/bio.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var bioSchema = mongoose.Schema({
},
phonenumber: {
type: String,
required: false
required: true
},
emergencycontactname: {
type: String,
Expand Down Expand Up @@ -213,6 +213,10 @@ var bioSchema = mongoose.Schema({
type: String,
required: false
},
userphone: {
type: String,
required: false
},
useraddress: {
type: String,
required: false
Expand Down
6 changes: 5 additions & 1 deletion app/models/itec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var itecSchema = mongoose.Schema({
},
phonenumber: {
type: String,
required: false
required: true
},
classification: {
type: String,
Expand Down Expand Up @@ -175,6 +175,10 @@ var itecSchema = mongoose.Schema({
type: String,
required: false
},
userphone: {
type: String,
required: false
},
useraddress: {
type: String,
required: false
Expand Down
12 changes: 8 additions & 4 deletions app/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ var ctrlMongoToCsv = require('../controllers/mongoToCsv');
var ctrlUpload = require('../controllers/documentUpload');
var ctrlDelete = require('../controllers/documentDelete');
var ctrlSiteNotes = require('../controllers/sitenotes');
//var ctrlMultiDownload = require('../controllers/ ');
var ctrlSupport = require('../controllers/support');




Expand Down Expand Up @@ -188,10 +189,10 @@ module.exports = function (app, passport) {
app.get('/site/contacts/:siteid/:documentid', isLoggedIn, isAdminOrInstructor, ctrlSites.deleteSiteContact);
app.get('/site/edit/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.getSiteToEdit);
app.get('/site/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.getSiteDetails);
app.post('/addSite', isLoggedIn, isAdmin, ctrlSites.postAddSite);
app.post('/addSite', isLoggedIn, isAdminOrInstructor, ctrlSites.postAddSite);
app.post('/site/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.addSiteContact);
app.post('/site/edit/:siteid', isLoggedIn, isAdmin, ctrlSites.updateSite);
app.post('/site/delete/:siteid', isLoggedIn, isAdmin, ctrlSites.deleteSite);
app.post('/site/edit/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.updateSite);
app.post('/site/delete/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.deleteSite);
app.get('/site/:siteId/export/contacts', makeCSVDirectory, isLoggedIn, isAdminOrInstructor, ctrlSites.exportContacts);

/* Promote page */
Expand All @@ -205,6 +206,9 @@ module.exports = function (app, passport) {
/* FAQ page */
app.get('/faq', ctrlFAQ.getFAQ);

/* Support Page */
app.get('/support', ctrlSupport.getSupport);

/* Help page */
app.get('/help', ctrlHelp.getHelp);
app.get('/admininstructorhelp', ctrlHelp.getAdminInstructorHelp);
Expand Down
Binary file modified documentation/fall2021/Client_Requirements.docx
Binary file not shown.
Binary file not shown.
Binary file added documentation/fall2021/~$ient_Requirements.docx
Binary file not shown.
Loading