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(); } }