ENH: Collection List (#20)
This commit is contained in:
parent
77071dfa35
commit
55a1c4fca6
26 changed files with 284 additions and 3 deletions
10
app/models/collection-method.js
Normal file
10
app/models/collection-method.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import DS from 'ember-data';
|
||||
|
||||
const { Model, attr } = DS;
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
code: attr('string'),
|
||||
collectionMethodClass: attr('string'),
|
||||
sortOrder: attr('number'),
|
||||
});
|
9
app/models/collection-type.js
Normal file
9
app/models/collection-type.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import DS from 'ember-data';
|
||||
|
||||
const { Model, attr } = DS;
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
code: attr('string'),
|
||||
sortOrder: attr('number'),
|
||||
});
|
31
app/models/collection.js
Normal file
31
app/models/collection.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
|
||||
const { computed } = Ember;
|
||||
const { Model, attr, belongsTo } = DS;
|
||||
|
||||
export default Model.extend({
|
||||
displayName: attr('string'),
|
||||
numberOfTraps: attr('number'),
|
||||
collectionStartDate: attr('string-null-to-empty'),
|
||||
collectionStartTime: attr('string-null-to-empty'),
|
||||
collectionEndDate: attr('string-null-to-empty'),
|
||||
collectionEndTime: attr('string-null-to-empty'),
|
||||
|
||||
project: belongsTo('project'),
|
||||
studyLocation: belongsTo('study-location'),
|
||||
collectionMethod: belongsTo('collection-method'),
|
||||
collectionType: belongsTo('collection-type'),
|
||||
|
||||
startDateTime: computed('collectionStartDate', 'collectionStartTime',
|
||||
function() { return this._mergeDateTime('Start'); }),
|
||||
|
||||
endDateTime: computed('collectionEndDate', 'collectionEndTime',
|
||||
function() { return this._mergeDateTime('End'); }),
|
||||
|
||||
_mergeDateTime(timepoint) {
|
||||
const date = this.get(`collection${timepoint}Date`);
|
||||
const time = this.get(`collection${timepoint}Time`);
|
||||
return `${date} ${time}`.trim();
|
||||
},
|
||||
});
|
11
app/models/project.js
Normal file
11
app/models/project.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import DS from 'ember-data';
|
||||
|
||||
const { Model, attr } = DS;
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
code: attr('string'),
|
||||
iacucNumber: attr('string'),
|
||||
description: attr('string'),
|
||||
sortOrder: attr('number'),
|
||||
});
|
13
app/models/study-location.js
Normal file
13
app/models/study-location.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import DS from 'ember-data';
|
||||
|
||||
const { Model, attr } = DS;
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
code: attr('string'),
|
||||
studyLocationType: attr('string'),
|
||||
treatmentType: attr('string'),
|
||||
collectingLocation: attr('string'),
|
||||
description: attr('string'),
|
||||
sortOrder: attr('number'),
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue