bug button, data service, user level adjustments, multiple sample support for edit dialog, validation functionality
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import pick from 'lodash/pick';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import {IdModel} from './id.model';
|
||||
import {MaterialModel} from './material.model';
|
||||
import {MeasurementModel} from './measurement.model';
|
||||
@ -10,12 +11,13 @@ export class SampleModel extends BaseModel {
|
||||
number = '';
|
||||
type = '';
|
||||
batch = '';
|
||||
condition: {condition_template: string, [prop: string]: string} | {} = {};
|
||||
condition: {condition_template: string, [prop: string]: string} = {condition_template: null};
|
||||
material_id: IdModel = null;
|
||||
material: MaterialModel;
|
||||
measurements: MeasurementModel[] = [];
|
||||
note_id: IdModel = null;
|
||||
user_id: IdModel = null;
|
||||
validate = false;
|
||||
notes: {
|
||||
comment: string,
|
||||
sample_references: {sample_id: IdModel, relation: string}[],
|
||||
@ -39,6 +41,14 @@ export class SampleModel extends BaseModel {
|
||||
}
|
||||
|
||||
sendFormat() {
|
||||
return pick(this, ['color', 'type', 'batch', 'condition', 'material_id', 'notes']);
|
||||
return pick(this.conditionTemplateCheck(), ['color', 'type', 'batch', 'condition', 'material_id', 'notes']);
|
||||
}
|
||||
|
||||
private conditionTemplateCheck() {
|
||||
const res = cloneDeep(this);
|
||||
if (res.condition.condition_template === null) {
|
||||
res.condition = {};
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user