@dhyasama/totem-models 6.3.6 → 6.3.7
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/.npmignore +14 -0
- package/lib/Organization.js +9 -25
- package/package-lock.json +1829 -0
- package/package.json +1 -1
- package/test/Organization.js +10 -14
package/.npmignore
ADDED
package/lib/Organization.js
CHANGED
|
@@ -215,8 +215,8 @@ module.exports = function(mongoose, config) {
|
|
|
215
215
|
|
|
216
216
|
standardFields: {
|
|
217
217
|
|
|
218
|
-
//
|
|
219
|
-
//
|
|
218
|
+
// Standard fields are always "on" in the system
|
|
219
|
+
// They can be configured in how they work on the deal list page
|
|
220
220
|
// order for standard fields only sets the order on the list page. their position is fixed on the org page deal section and edit form.
|
|
221
221
|
// order is co-mingled with order for custom fields
|
|
222
222
|
// colspan is for the number of columns the field should take up on the list page
|
|
@@ -224,7 +224,6 @@ module.exports = function(mongoose, config) {
|
|
|
224
224
|
// showOnList controls if the field will be on deal list page
|
|
225
225
|
|
|
226
226
|
fundraise: {
|
|
227
|
-
active: { type: Boolean, default: true },
|
|
228
227
|
order: { type: Number, default: 99 },
|
|
229
228
|
colspan: { type: Number, default: 1 },
|
|
230
229
|
showOnFilter: { type: Boolean, default: true },
|
|
@@ -232,7 +231,6 @@ module.exports = function(mongoose, config) {
|
|
|
232
231
|
},
|
|
233
232
|
|
|
234
233
|
sources: {
|
|
235
|
-
active: { type: Boolean, default: true },
|
|
236
234
|
order: { type: Number, default: 99 },
|
|
237
235
|
colspan: { type: Number, default: 1 },
|
|
238
236
|
showOnFilter: { type: Boolean, default: true },
|
|
@@ -240,7 +238,6 @@ module.exports = function(mongoose, config) {
|
|
|
240
238
|
},
|
|
241
239
|
|
|
242
240
|
referrers: {
|
|
243
|
-
active: { type: Boolean, default: true },
|
|
244
241
|
order: { type: Number, default: 99 },
|
|
245
242
|
colspan: { type: Number, default: 1 },
|
|
246
243
|
showOnFilter: { type: Boolean, default: true },
|
|
@@ -248,7 +245,6 @@ module.exports = function(mongoose, config) {
|
|
|
248
245
|
},
|
|
249
246
|
|
|
250
247
|
resources: {
|
|
251
|
-
active: { type: Boolean, default: true },
|
|
252
248
|
order: { type: Number, default: 99 },
|
|
253
249
|
colspan: { type: Number, default: 1 },
|
|
254
250
|
showOnFilter: { type: Boolean, default: true },
|
|
@@ -282,7 +278,7 @@ module.exports = function(mongoose, config) {
|
|
|
282
278
|
// This is the value that gets stored
|
|
283
279
|
value: { type: String, trim: true, required: true },
|
|
284
280
|
|
|
285
|
-
// This is used to
|
|
281
|
+
// This is used to aggregate answers for polls
|
|
286
282
|
type: { type: String, enum: ['String', 'Number', 'Boolean'], required: true }
|
|
287
283
|
|
|
288
284
|
}],
|
|
@@ -501,11 +497,10 @@ module.exports = function(mongoose, config) {
|
|
|
501
497
|
|
|
502
498
|
});
|
|
503
499
|
|
|
504
|
-
Organization.virtual('customer.deals.
|
|
500
|
+
Organization.virtual('customer.deals.fields').get(function () {
|
|
505
501
|
|
|
506
502
|
// Combine ever-present fields, standard fields and custom fields into a single list and sort by column order
|
|
507
503
|
// Fundraise is actually two fields, so multiply the order by ten to make room for the extra field
|
|
508
|
-
// Returns tuples of name/order
|
|
509
504
|
|
|
510
505
|
var self = this;
|
|
511
506
|
|
|
@@ -514,15 +509,12 @@ module.exports = function(mongoose, config) {
|
|
|
514
509
|
// Defaulting to off so it will be immediately apparent the customer hasn't been properly configured
|
|
515
510
|
standardFields = standardFields || {
|
|
516
511
|
fundraise: {
|
|
517
|
-
active: false,
|
|
518
512
|
showOnList: false
|
|
519
513
|
},
|
|
520
514
|
sources: {
|
|
521
|
-
active: false,
|
|
522
515
|
showOnList: false
|
|
523
516
|
},
|
|
524
517
|
referrers: {
|
|
525
|
-
active: false,
|
|
526
518
|
showOnList: false
|
|
527
519
|
}
|
|
528
520
|
};
|
|
@@ -531,18 +523,19 @@ module.exports = function(mongoose, config) {
|
|
|
531
523
|
var result = [];
|
|
532
524
|
|
|
533
525
|
// Add the standard fields that are active
|
|
534
|
-
if (standardFields.fundraise.
|
|
526
|
+
if (standardFields.fundraise.showOnList) {
|
|
535
527
|
result.push({
|
|
536
528
|
name: 'Fundraise Amount',
|
|
537
529
|
order: standardFields.fundraise.order * 10,
|
|
538
530
|
colspan: standardFields.fundraise.colspan
|
|
539
531
|
}, {
|
|
540
532
|
name: 'Fundraise Valuation',
|
|
541
|
-
order: standardFields.fundraise.order * 10 + 1
|
|
533
|
+
order: standardFields.fundraise.order * 10 + 1,
|
|
534
|
+
colspan: standardFields.fundraise.colspan
|
|
542
535
|
});
|
|
543
536
|
}
|
|
544
537
|
|
|
545
|
-
if (standardFields.sources.
|
|
538
|
+
if (standardFields.sources.showOnList) {
|
|
546
539
|
result.push({
|
|
547
540
|
name: 'Source',
|
|
548
541
|
order: standardFields.sources.order * 10,
|
|
@@ -550,7 +543,7 @@ module.exports = function(mongoose, config) {
|
|
|
550
543
|
});
|
|
551
544
|
}
|
|
552
545
|
|
|
553
|
-
if (standardFields.referrers.
|
|
546
|
+
if (standardFields.referrers.showOnList) {
|
|
554
547
|
result.push({
|
|
555
548
|
name: 'Referrers',
|
|
556
549
|
order: standardFields.referrers.order * 10,
|
|
@@ -572,15 +565,6 @@ module.exports = function(mongoose, config) {
|
|
|
572
565
|
// Sort the combined standard and custom fields
|
|
573
566
|
result = _.sortBy(result, function(item) { return item.order; });
|
|
574
567
|
|
|
575
|
-
// Put the ever-present fields at the beginning
|
|
576
|
-
result.unshift({
|
|
577
|
-
name: 'Company',
|
|
578
|
-
order: 0
|
|
579
|
-
}, {
|
|
580
|
-
name: 'Stage',
|
|
581
|
-
order: 1
|
|
582
|
-
});
|
|
583
|
-
|
|
584
568
|
// Now that we have all fields combined and ordered, make column order zero-indexed and gap-free
|
|
585
569
|
result = _.map(result, function(item, index) {
|
|
586
570
|
item.order = index;
|