definma-ui/src/app/models/material.model.ts

28 lines
660 B
TypeScript
Raw Normal View History

import _ from 'lodash';
import {IdModel} from './id.model';
import {BaseModel} from './base.model';
export class MaterialModel extends BaseModel {
_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();
}
}