added batch edit

This commit is contained in:
VLE2FE
2020-08-21 16:11:57 +02:00
parent 433572f819
commit 602dfb51da
11 changed files with 558 additions and 343 deletions

View File

@ -8,6 +8,7 @@ export class MeasurementModel extends BaseModel {
sample_id: IdModel = null;
measurement_template: IdModel;
values: {[prop: string]: any} = {};
status = '';
constructor(measurementTemplate: IdModel = null) {
super();

View File

@ -17,7 +17,7 @@ export class SampleModel extends BaseModel {
measurements: MeasurementModel[] = [];
note_id: IdModel = null;
user_id: IdModel = null;
validate = false;
selected = false;
notes: {
comment: string,
sample_references: {sample_id: IdModel, relation: string}[],
@ -42,7 +42,16 @@ export class SampleModel extends BaseModel {
}
sendFormat() {
return pick(this.conditionTemplateCheck(), ['color', 'type', 'batch', 'condition', 'material_id', 'notes']);
const tmp = pick(this.conditionTemplateCheck(), ['color', 'type', 'batch', 'condition', 'material_id', 'notes']);
Object.keys(tmp).forEach(key => {
if (tmp[key] === undefined) {
delete tmp[key];
}
});
if (this.material && this.material.name === undefined) {
delete tmp.material_id;
}
return tmp;
}
private conditionTemplateCheck() {