Added formula editor (Fixes #12)

This commit is contained in:
Zakary Timson 2018-07-24 22:20:40 -04:00
parent dbd269a995
commit cf04bfc799
2 changed files with 12 additions and 0 deletions

View File

@ -51,6 +51,10 @@ export class FormulaManagerComponent {
return cost;
}
edit(formula) {
this.dialog.open(NewFormulaComponent, {data: formula});
}
delete(formula) {
this.dialog.open(DeleteComponent, {data: formula});
}

View File

@ -26,6 +26,14 @@ export class NewFormulaComponent {
@Inject(MAT_DIALOG_DATA) public data
) {
this.store.components.subscribe(rows => (this.componentsList = rows));
if (this.data) {
this.name = this.data.name;
this.approved = this.data.approved;
this.components = this.data.components.map(row => {
return {component: row.component.id, name: row.component.name, quantity: row.quantity};
});
}
}
add() {