Skip to content

Commit 0efe2fe

Browse files
author
Manuel Rauber
committed
Deleting a customer
1 parent b2b1dca commit 0efe2fe

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/ng2client/app/components/adminCustomerList/adminCustomerList.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ <h1>Customer list</h1>
33
<div class="span-1">
44
<div class="flakes-actions-bar">
55
<a class="action button-gray smaller" [routerLink]="['AdminCustomersCreate']">Create new customer</a>
6+
<span class="action button-gray smaller" [hidden]="!selectedCustomer" (click)="deleteSelectedCustomer()">Delete selected customer</span>
67
</div>
78
<table class="flakes-table">
89
<thead>

src/ng2client/app/components/adminCustomerList/adminCustomerList.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,13 @@ export class AdminCustomerListComponent implements OnInit {
2727
this.selectedCustomer = undefined;
2828
});
2929
}
30+
31+
public deleteSelectedCustomer(): void {
32+
if (!this.selectedCustomer) {
33+
return;
34+
}
35+
36+
this._customerApiService.remove(this.selectedCustomer.id)
37+
.subscribe(() => this.refresh());
38+
}
3039
}

src/ng2client/less/main.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@ li.router-link-active {
6767
table.flakes-table tbody tr.active td {
6868
background-color: lightgray;
6969
}
70+
71+
[hidden] {
72+
display: none;
73+
}

0 commit comments

Comments
 (0)