Feature: Added the customer module to list / edit customers. This is needed to add the customer discount functionality
This commit is contained in:
@ -0,0 +1,28 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { Customer } from '../../core/customer';
|
||||
|
||||
import { CustomerListDatasource } from './customer-list-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-customer-list',
|
||||
templateUrl: './customer-list.component.html',
|
||||
styleUrls: ['./customer-list.component.css'],
|
||||
})
|
||||
export class CustomerListComponent implements OnInit {
|
||||
dataSource: CustomerListDatasource = new CustomerListDatasource([]);
|
||||
list: Customer[] = [];
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'phone', 'address'];
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { list: Customer[] };
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new CustomerListDatasource(this.list);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user