This commit is contained in:
Le Deng
2017-03-06 12:32:56 -05:00
parent 41cd750b8d
commit 29a2be1480
3 changed files with 44 additions and 16 deletions

View File

@@ -17,7 +17,7 @@
<tr *ngFor="let book of bookList">
<td>
<input hidden="hidden" name="id" />
<input class="checkboxBook" type="checkbox"/>
<input type="checkbox" [checked]="checked" (change)="updateRemoveBookList($event.target.checked, book)" />
</td>
<td><a (click)="onSelect(book)" style="cursor: pointer">{{book.title}}</a></td>
<td>{{book.author}}</td>
@@ -35,6 +35,6 @@
</tbody>
</table>
</div>
<button md-raised-button class="mat-warn" id="deleteSelected">Delete Selected</button>
<button md-raised-button class="mat-warn" id="deleteSelected" (click)="removeSelectedBooks()">Delete Selected</button>
</div>

View File

@@ -16,6 +16,7 @@ export class BookListComponent implements OnInit {
private selectedBook : Book;
private bookList: Book[];
private removeBookList: Book[]=new Array();
constructor(private removeBookService:RemoveBookService, private getBookListService: GetBookListService, private router: Router, public dialog: MdDialog) {
this.getBookListService.getBookList().subscribe(
@@ -26,7 +27,7 @@ export class BookListComponent implements OnInit {
err => {
console.log(err);
}
);
);
}
onSelect(book:Book) {
@@ -40,18 +41,45 @@ export class BookListComponent implements OnInit {
console.log(result);
if(result=="yes") {
this.removeBookService.sendBook(book.id).subscribe(
res => {
console.log(res);
location.reload();
},
err => {
console.log(err);
res => {
console.log(res);
location.reload();
},
err => {
console.log(err);
}
);
}
);
});
}
updateRemoveBookList(checked:boolean, book:Book) {
if(checked){
this.removeBookList.push(book);
} else {
this.removeBookList.splice(this.removeBookList.indexOf(book),1);
}
console.log(this.removeBookList);
}
removeSelectedBooks() {
let dialogRef = this.dialog.open(DialogResultExampleDialog);
dialogRef.afterClosed().subscribe(result => {
if(result=="yes") {
for (let book of this.removeBookList) {
this.removeBookService.sendBook(book.id).subscribe(
res => {
},
err => {
}
);
};
location.reload();
}
});
}
});
}
ngOnInit() {

View File

@@ -841,12 +841,12 @@
<workItem from="1486538831944" duration="450000" />
<workItem from="1488378219247" duration="650000" />
<workItem from="1488461561430" duration="18419000" />
<workItem from="1488731165185" duration="6656000" />
<workItem from="1488731165185" duration="7270000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="68668000" />
<option name="totallyTimeSpent" value="69282000" />
</component>
<component name="ToolWindowManager">
<frame x="71" y="38" width="1663" height="961" extended-state="0" />
@@ -869,7 +869,7 @@
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26697353" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26697353" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Spring" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32907802" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />