mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
tweaks
This commit is contained in:
@ -8,6 +8,8 @@ var TimeClockSpan = mongoose.model('TimeClockSpan');
|
||||
var TimeClockException = mongoose.model('TimeClockException');
|
||||
var TimeSheet = mongoose.model('TimeSheet');
|
||||
var Workorder = mongoose.model('Workorder');
|
||||
var Device = mongoose.model('Device');
|
||||
var DeviceType = mongoose.model('DeviceType');
|
||||
var email = require('../util/email');
|
||||
var config = require('../../config/config')['prod'];
|
||||
|
||||
@ -109,9 +111,31 @@ function findUserWorkorder(id, user) {
|
||||
};
|
||||
|
||||
return Workorder
|
||||
.findOne(query)
|
||||
.findOne({
|
||||
_id: id,
|
||||
techs: user.id,
|
||||
deleted: false
|
||||
})
|
||||
.populate('client', 'name identifier contacts address')
|
||||
.exec();
|
||||
.then(workorder => {
|
||||
var ids = _(workorder.devices)
|
||||
.reject(_.isUndefined)
|
||||
.uniq(id => id.toString())
|
||||
.value();
|
||||
|
||||
return Device
|
||||
.find({
|
||||
_id: {
|
||||
$in: ids
|
||||
}
|
||||
})
|
||||
.populate('deviceType')
|
||||
.select('biomedId deviceType serialNumber')
|
||||
.then(devices => {
|
||||
workorder.devices = devices;
|
||||
return workorder;
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function filterSpans(spans, filter) {
|
||||
@ -614,6 +638,8 @@ module.exports = function () {
|
||||
|
||||
//TODO: Check to make sure user has a valid timesheet.
|
||||
|
||||
var today = moment();
|
||||
|
||||
hasTechApprovedPreviousWeek(req.user.id, today)
|
||||
.then(approved => {
|
||||
|
||||
|
@ -7,7 +7,7 @@ var testRunSchema = new Schema({
|
||||
fields: [{}],
|
||||
date: Date,
|
||||
result: Boolean,
|
||||
comment: String,
|
||||
comments: String,
|
||||
deleted: { type: Boolean, default: false }
|
||||
});
|
||||
|
||||
|
@ -78,6 +78,9 @@
|
||||
</tr>
|
||||
<% } %>
|
||||
<% if (biomedId) { %>
|
||||
<tr style="margin-top: 24px;">
|
||||
<td colspan="2"><h4>Workorder</h4></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Atlantic Biomedical ID</td>
|
||||
<td><%- biomedId %></td>
|
||||
|
@ -18,6 +18,9 @@ Phone Number:
|
||||
|
||||
<% } %>
|
||||
<% if (biomedId) { %>
|
||||
|
||||
|
||||
Workorder
|
||||
Atlantic Biomedical ID:
|
||||
<%- biomedId %>
|
||||
|
||||
|
Reference in New Issue
Block a user