@dhyasama/totem-models 7.2.3 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/CapTable.js +12 -0
- package/lib/Financials.js +26 -12
- package/package.json +1 -1
package/lib/CapTable.js
CHANGED
|
@@ -254,6 +254,18 @@ module.exports = function(mongoose, config) {
|
|
|
254
254
|
|
|
255
255
|
};
|
|
256
256
|
|
|
257
|
+
CapTable.statics.getAllForCustomer2 = function getAllForCustomer2(customerId, cb) {
|
|
258
|
+
|
|
259
|
+
var self = this;
|
|
260
|
+
|
|
261
|
+
self
|
|
262
|
+
.find({customer: customerId })
|
|
263
|
+
.populate('stakeholders.person', 'name avatarUrl title')
|
|
264
|
+
.populate('stakeholders.fund', 'name shortName')
|
|
265
|
+
.exec(cb);
|
|
266
|
+
|
|
267
|
+
};
|
|
268
|
+
|
|
257
269
|
CapTable.statics.getByFunds = function getByFunds(fundIds, cb) {
|
|
258
270
|
|
|
259
271
|
var self = this;
|
package/lib/Financials.js
CHANGED
|
@@ -12,12 +12,8 @@ module.exports = function(mongoose, config) {
|
|
|
12
12
|
var Schema = mongoose.Schema;
|
|
13
13
|
var async = require('async');
|
|
14
14
|
var _ = require('underscore');
|
|
15
|
+
var moment = require('moment');
|
|
15
16
|
|
|
16
|
-
// scheduled
|
|
17
|
-
// not scheduled (skipped)
|
|
18
|
-
// submitted
|
|
19
|
-
|
|
20
|
-
|
|
21
17
|
var Financials = new Schema({
|
|
22
18
|
|
|
23
19
|
organization: { type: Schema.ObjectId, ref: 'Organization', required: true, index: true },
|
|
@@ -36,6 +32,8 @@ module.exports = function(mongoose, config) {
|
|
|
36
32
|
|
|
37
33
|
status: { type: String },
|
|
38
34
|
|
|
35
|
+
action: { type: String },
|
|
36
|
+
|
|
39
37
|
year: { type: Number, default: 0 },
|
|
40
38
|
period: { type: String, enum: ['Annual', 'Q1', 'Q2', 'Q3', 'Q4', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] },
|
|
41
39
|
|
|
@@ -382,20 +380,38 @@ module.exports = function(mongoose, config) {
|
|
|
382
380
|
|
|
383
381
|
if(!snapshot) return;
|
|
384
382
|
|
|
385
|
-
else if(!snapshot.uuid || snapshot.submittedOn)
|
|
383
|
+
else if(!snapshot.uuid || snapshot.submittedOn) {
|
|
384
|
+
snapshot.status = 'Completed';
|
|
385
|
+
snapshot.action = null;
|
|
386
|
+
}
|
|
386
387
|
|
|
387
388
|
else if(snapshot.notifications.company.initial.sendOn) {
|
|
388
389
|
|
|
389
390
|
var isScheduled = moment().isBefore(moment(snapshot.notifications.company.initial.sendOn));
|
|
390
391
|
var isOverdue = moment().subtract(30, 'd').isAfter(moment(snapshot.notifications.company.reminder.sendOn || snapshot.notifications.company.initial.sendOn));
|
|
392
|
+
|
|
393
|
+
if(isScheduled) {
|
|
394
|
+
snapshot.status = 'Scheduled';
|
|
395
|
+
snapshot.action = null;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
else if(isOverdue) {
|
|
399
|
+
snapshot.status = 'Overdue';
|
|
400
|
+
snapshot.action = null;
|
|
401
|
+
}
|
|
391
402
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
403
|
+
else {
|
|
404
|
+
snapshot.status = 'In Progress';
|
|
405
|
+
if(snapshot.notifications.company.reminder.status) snapshot.action = 'Reminder ' + snapshot.notifications.company.reminder.status;
|
|
406
|
+
else if (snapshot.notifications.company.initial.status) snapshot.action = 'Initial ' + snapshot.notifications.company.initial.status;
|
|
407
|
+
}
|
|
395
408
|
|
|
396
409
|
}
|
|
397
410
|
|
|
398
|
-
else
|
|
411
|
+
else {
|
|
412
|
+
snapshot.status = 'Not Scheduled';
|
|
413
|
+
snapshot.action = null;
|
|
414
|
+
}
|
|
399
415
|
|
|
400
416
|
});
|
|
401
417
|
|
|
@@ -413,8 +429,6 @@ module.exports = function(mongoose, config) {
|
|
|
413
429
|
// todo
|
|
414
430
|
});
|
|
415
431
|
|
|
416
|
-
|
|
417
|
-
|
|
418
432
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
419
433
|
// CONFIG
|
|
420
434
|
///////////////////////////////////////////////////////////////////////////////////////
|