Added tags to clients page

This commit is contained in:
Dobie Wollert
2013-07-19 01:27:47 -07:00
parent 1c2ba2737d
commit 4380c10ba4
8 changed files with 58 additions and 5 deletions

View File

@ -1,7 +1,8 @@
var mongoose = require('mongoose'),
Client = mongoose.model('Client'),
Workorder = mongoose.model('Workorder');
Workorder = mongoose.model('Workorder'),
Tag = mongoose.model('Tag');
var frequencies = ["annual","semi","quarterly","sterilizer","tg","ert","rae","medgas","imaging","neptune","anesthesia"];
@ -58,6 +59,18 @@ exports.workorders = function(req, res, next) {
});
};
exports.tags = function(req, res, next) {
var id = req.param('client_id');
Tag.find({ client: id })
.exec(function(err, tags) {
if (err) return next(err);
if (!tags) return next(new Error('Failed to load tags ' + id));
res.json(tags);
});
};
exports.create = function(req, res, next) {
console.log(req.body);

View File

@ -104,7 +104,7 @@ html(lang="en", ng-app="tags", ng-controller="tags.PageCtrl")
.control-group
label.control-label Device Warranty Expiration
.controls
input.text(type='date', ng-model='deviceWarrantyExpiration')
input.text(type='date', ng-model='tag.deviceWarrantyExpiration')
.control-group
label.control-label Test