Fix: Discount and payment received were not working
This commit is contained in:
@ -26,7 +26,7 @@ import {
|
||||
MatRow,
|
||||
} from '@angular/material/table';
|
||||
import { round } from 'mathjs';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
|
||||
import { DiscountDataSource } from './discount-datasource';
|
||||
import { DiscountItem } from './discount-item';
|
||||
@ -71,7 +71,8 @@ export class DiscountComponent {
|
||||
>;
|
||||
}>;
|
||||
|
||||
dataSource: DiscountDataSource = new DiscountDataSource([]);
|
||||
public listObservable = new BehaviorSubject<DiscountItem[]>([]);
|
||||
dataSource: DiscountDataSource = new DiscountDataSource(this.listObservable);
|
||||
|
||||
displayedColumns = ['name', 'discount'];
|
||||
|
||||
@ -91,6 +92,7 @@ export class DiscountComponent {
|
||||
|
||||
this.data.subscribe((list: DiscountItem[]) => {
|
||||
this.list = list;
|
||||
console.log(list);
|
||||
this.form.controls.discounts.clear();
|
||||
|
||||
this.list.forEach((x) => {
|
||||
@ -104,7 +106,7 @@ export class DiscountComponent {
|
||||
}),
|
||||
);
|
||||
});
|
||||
this.dataSource = new DiscountDataSource(this.list);
|
||||
this.listObservable.next(this.list);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user