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 TimeClockException = mongoose.model('TimeClockException');
|
||||||
var TimeSheet = mongoose.model('TimeSheet');
|
var TimeSheet = mongoose.model('TimeSheet');
|
||||||
var Workorder = mongoose.model('Workorder');
|
var Workorder = mongoose.model('Workorder');
|
||||||
|
var Device = mongoose.model('Device');
|
||||||
|
var DeviceType = mongoose.model('DeviceType');
|
||||||
var email = require('../util/email');
|
var email = require('../util/email');
|
||||||
var config = require('../../config/config')['prod'];
|
var config = require('../../config/config')['prod'];
|
||||||
|
|
||||||
@ -109,9 +111,31 @@ function findUserWorkorder(id, user) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return Workorder
|
return Workorder
|
||||||
.findOne(query)
|
.findOne({
|
||||||
|
_id: id,
|
||||||
|
techs: user.id,
|
||||||
|
deleted: false
|
||||||
|
})
|
||||||
.populate('client', 'name identifier contacts address')
|
.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) {
|
function filterSpans(spans, filter) {
|
||||||
@ -614,6 +638,8 @@ module.exports = function () {
|
|||||||
|
|
||||||
//TODO: Check to make sure user has a valid timesheet.
|
//TODO: Check to make sure user has a valid timesheet.
|
||||||
|
|
||||||
|
var today = moment();
|
||||||
|
|
||||||
hasTechApprovedPreviousWeek(req.user.id, today)
|
hasTechApprovedPreviousWeek(req.user.id, today)
|
||||||
.then(approved => {
|
.then(approved => {
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ var testRunSchema = new Schema({
|
|||||||
fields: [{}],
|
fields: [{}],
|
||||||
date: Date,
|
date: Date,
|
||||||
result: Boolean,
|
result: Boolean,
|
||||||
comment: String,
|
comments: String,
|
||||||
deleted: { type: Boolean, default: false }
|
deleted: { type: Boolean, default: false }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -78,6 +78,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (biomedId) { %>
|
<% if (biomedId) { %>
|
||||||
|
<tr style="margin-top: 24px;">
|
||||||
|
<td colspan="2"><h4>Workorder</h4></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Atlantic Biomedical ID</td>
|
<td>Atlantic Biomedical ID</td>
|
||||||
<td><%- biomedId %></td>
|
<td><%- biomedId %></td>
|
||||||
|
@ -18,6 +18,9 @@ Phone Number:
|
|||||||
|
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (biomedId) { %>
|
<% if (biomedId) { %>
|
||||||
|
|
||||||
|
|
||||||
|
Workorder
|
||||||
Atlantic Biomedical ID:
|
Atlantic Biomedical ID:
|
||||||
<%- biomedId %>
|
<%- biomedId %>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user