2020-06-19 08:43:22 +02:00
|
|
|
import _ from 'lodash';
|
|
|
|
import {IdModel} from './id.model';
|
2020-06-22 10:22:45 +02:00
|
|
|
import {BaseModel} from './base.model';
|
2020-06-19 08:43:22 +02:00
|
|
|
|
2020-06-22 10:22:45 +02:00
|
|
|
export class MaterialModel extends BaseModel {
|
2020-06-19 08:43:22 +02:00
|
|
|
_id: IdModel = null;
|
|
|
|
name = '';
|
|
|
|
supplier = '';
|
|
|
|
group = '';
|
|
|
|
mineral = 0;
|
|
|
|
glass_fiber = 0;
|
|
|
|
carbon_fiber = 0;
|
|
|
|
private numberTemplate = {color: '', number: ''};
|
|
|
|
numbers: {color: string, number: string}[] = [_.cloneDeep(this.numberTemplate)];
|
|
|
|
|
|
|
|
sendFormat() {
|
|
|
|
return _.pick(this, ['name', 'supplier', 'group', 'mineral', 'glass_fiber', 'carbon_fiber', 'numbers']);
|
|
|
|
}
|
|
|
|
|
|
|
|
addNumber() {
|
|
|
|
this.numbers.push(_.cloneDeep(this.numberTemplate));
|
|
|
|
}
|
|
|
|
|
|
|
|
popNumber() {
|
|
|
|
this.numbers.pop();
|
|
|
|
}
|
|
|
|
}
|