diff --git a/app/controllers/clients.js b/app/controllers/clients.js index cfcb5a5..f22885a 100644 --- a/app/controllers/clients.js +++ b/app/controllers/clients.js @@ -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); diff --git a/app/views/tag.jade b/app/views/tag.jade index ed04e84..fd0c191 100644 --- a/app/views/tag.jade +++ b/app/views/tag.jade @@ -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 diff --git a/config/config.js b/config/config.js index 75b95d8..c0294fc 100644 --- a/config/config.js +++ b/config/config.js @@ -2,7 +2,7 @@ module.exports = { development: { root: require('path').normalize(__dirname + '/..'), debug: true, - database: 'mongodb://wootbox.wootroot.me/biomed_devel2', + database: 'mongodb://wootbox.wootroot.me/biomed_prod', auth: { clientId: '223145213165.apps.googleusercontent.com', clientSecret: '8MRNar9E_pRTOGTQonPzYOW_', diff --git a/config/routes.js b/config/routes.js index bc86fd7..3042085 100644 --- a/config/routes.js +++ b/config/routes.js @@ -25,6 +25,7 @@ module.exports = function(app, auth, piler, calendar, config) { app.get('/api/clients/frequencies', clients.frequencies); app.get('/api/clients/:client_id', clients.get); app.get('/api/clients/:client_id/workorders', clients.workorders); + app.get('/api/clients/:client_id/tags', clients.tags); app.post('/api/clients', clients.create); app.post('/api/clients/:client_id', clients.update); app.del('/api/clients/:client_id', clients.destroy); diff --git a/package.json b/package.json index 6678c2e..7f7e33b 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "sprintf": "", "emailjs": "", "moment": "", - "async": "" + "async": "", + "passport-oauth": "" }, "devDependencies": { "supervisor": "" diff --git a/public/js/controllers.js b/public/js/controllers.js index aecee7b..3891fb7 100644 --- a/public/js/controllers.js +++ b/public/js/controllers.js @@ -122,6 +122,10 @@ biomed.ClientEditCtrl = function($scope, $routeParams, Clients) { updatePms(); }); + $scope.tags = Clients.tags($routeParams, function() { + + }); + $scope.identification = createController(); $scope.address = createController(); $scope.primaryContact = createContactController(0); diff --git a/public/js/services.js b/public/js/services.js index 47456d9..b02f124 100644 --- a/public/js/services.js +++ b/public/js/services.js @@ -9,7 +9,8 @@ angular.module('biomed.services', []) create: { method: 'POST', params: {} }, update: { method: 'POST', params: { id: 0} }, destroy: { method: 'DELETE', params: { id: 0 } }, - workorders: { method: 'GET', params: { id: 0, cmd: 'workorders' }, isArray: true } + workorders: { method: 'GET', params: { id: 0, cmd: 'workorders' }, isArray: true }, + tags: { method: 'GET', params: { id: 0, cmd: 'tags' }, isArray: true } }); }) .factory("Workorders", function($resource) { diff --git a/public/partials/clients/edit.html b/public/partials/clients/edit.html index 6654c89..8bf5ba7 100644 --- a/public/partials/clients/edit.html +++ b/public/partials/clients/edit.html @@ -285,4 +285,37 @@ +
Tag | +Device ID | +Device | +Make | +Model | +Serial No. | +Purchase Date | +Warranty Exp. | +
---|---|---|---|---|---|---|---|
{{tag._id}} | +{{tag.data.clientDeviceId}} | +{{tag.data.device}} | +{{tag.data.make}} | +{{tag.data.model}} | +{{tag.data.serialNumber}} | +{{tag.data.purchaseDate|date}} | +{{tag.data.deviceWarrantyExpiration|date}} | +