Strict done!!
This commit is contained in:
@@ -3,4 +3,12 @@ export class ClosingStockItem {
|
||||
group: string;
|
||||
quantity: number;
|
||||
amount: number;
|
||||
|
||||
public constructor(init?: Partial<ClosingStockItem>) {
|
||||
this.product = '';
|
||||
this.group = '';
|
||||
this.quantity = 0;
|
||||
this.amount = 0;
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ import { ClosingStockDataSource } from './closing-stock-datasource';
|
||||
export class ClosingStockComponent implements OnInit {
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
dataSource: ClosingStockDataSource;
|
||||
info: ClosingStock = new ClosingStock();
|
||||
dataSource: ClosingStockDataSource = new ClosingStockDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
info: ClosingStock;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['product', 'group', 'quantity', 'amount'];
|
||||
|
||||
@@ -44,7 +44,7 @@ export class ClosingStockComponent implements OnInit {
|
||||
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(),
|
||||
});
|
||||
});
|
||||
this.dataSource = new ClosingStockDataSource(this.paginator, this.sort, this.info.body);
|
||||
this.dataSource = new ClosingStockDataSource(this.info.body, this.paginator, this.sort);
|
||||
}
|
||||
|
||||
show() {
|
||||
@@ -55,9 +55,9 @@ export class ClosingStockComponent implements OnInit {
|
||||
getInfo(): ClosingStock {
|
||||
const formModel = this.form.value;
|
||||
|
||||
return {
|
||||
return new ClosingStock({
|
||||
date: moment(formModel.date).format('DD-MMM-YYYY'),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
|
||||
@@ -16,7 +16,7 @@ const serviceName = 'ClosingStockService';
|
||||
export class ClosingStockService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
list(date: string): Observable<ClosingStock> {
|
||||
list(date: string | null): Observable<ClosingStock> {
|
||||
const listUrl = date === null ? url : `${url}/${date}`;
|
||||
return <Observable<ClosingStock>>(
|
||||
this.http
|
||||
|
||||
@@ -2,5 +2,11 @@ import { ClosingStockItem } from './closing-stock-item';
|
||||
|
||||
export class ClosingStock {
|
||||
date: string;
|
||||
body?: ClosingStockItem[];
|
||||
body: ClosingStockItem[];
|
||||
|
||||
public constructor(init?: Partial<ClosingStock>) {
|
||||
this.date = '';
|
||||
this.body = [];
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user