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'), var mongoose = require('mongoose'),
Client = mongoose.model('Client'), 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"]; 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) { exports.create = function(req, res, next) {
console.log(req.body); console.log(req.body);

View File

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

View File

@ -2,7 +2,7 @@ module.exports = {
development: { development: {
root: require('path').normalize(__dirname + '/..'), root: require('path').normalize(__dirname + '/..'),
debug: true, debug: true,
database: 'mongodb://wootbox.wootroot.me/biomed_devel2', database: 'mongodb://wootbox.wootroot.me/biomed_prod',
auth: { auth: {
clientId: '223145213165.apps.googleusercontent.com', clientId: '223145213165.apps.googleusercontent.com',
clientSecret: '8MRNar9E_pRTOGTQonPzYOW_', clientSecret: '8MRNar9E_pRTOGTQonPzYOW_',

View File

@ -25,6 +25,7 @@ module.exports = function(app, auth, piler, calendar, config) {
app.get('/api/clients/frequencies', clients.frequencies); app.get('/api/clients/frequencies', clients.frequencies);
app.get('/api/clients/:client_id', clients.get); app.get('/api/clients/:client_id', clients.get);
app.get('/api/clients/:client_id/workorders', clients.workorders); 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', clients.create);
app.post('/api/clients/:client_id', clients.update); app.post('/api/clients/:client_id', clients.update);
app.del('/api/clients/:client_id', clients.destroy); app.del('/api/clients/:client_id', clients.destroy);

View File

@ -18,7 +18,8 @@
"sprintf": "", "sprintf": "",
"emailjs": "", "emailjs": "",
"moment": "", "moment": "",
"async": "" "async": "",
"passport-oauth": ""
}, },
"devDependencies": { "devDependencies": {
"supervisor": "" "supervisor": ""

View File

@ -122,6 +122,10 @@ biomed.ClientEditCtrl = function($scope, $routeParams, Clients) {
updatePms(); updatePms();
}); });
$scope.tags = Clients.tags($routeParams, function() {
});
$scope.identification = createController(); $scope.identification = createController();
$scope.address = createController(); $scope.address = createController();
$scope.primaryContact = createContactController(0); $scope.primaryContact = createContactController(0);

View File

@ -9,7 +9,8 @@ angular.module('biomed.services', [])
create: { method: 'POST', params: {} }, create: { method: 'POST', params: {} },
update: { method: 'POST', params: { id: 0} }, update: { method: 'POST', params: { id: 0} },
destroy: { method: 'DELETE', 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) { .factory("Workorders", function($resource) {

View File

@ -285,4 +285,37 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="tab-pane" title="Tags">
<div class="row-fluid">
<div class="span12">
<table class="biomed-table">
<thead>
<tr>
<th style="width: 10%">Tag</th>
<th style="width: 10%">Device ID</th>
<th style="width: 15%">Device</th>
<th style="width: 15%">Make</th>
<th style="width: 15%">Model</th>
<th style="width: 15%">Serial No.</th>
<th style="width: 20%">Purchase Date</th>
<th style="width: 20%">Warranty Exp.</th>
</tr>
</thead>
<tbody>
<tr ng-hide="tags.length"><td colspan="4" class="table-message">There is no information to display.</td></tr>
<tr ng-repeat="tag in tags">
<td>{{tag._id}}</td>
<td>{{tag.data.clientDeviceId}}</td>
<td>{{tag.data.device}}</td>
<td>{{tag.data.make}}</td>
<td>{{tag.data.model}}</td>
<td>{{tag.data.serialNumber}}</td>
<td>{{tag.data.purchaseDate|date}}</td>
<td>{{tag.data.deviceWarrantyExpiration|date}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div> </div>