From 5a9b7c8a003b2901a4d83e37b82908035ee77c67 Mon Sep 17 00:00:00 2001 From: Zavier Banks Date: Thu, 24 Oct 2019 22:08:24 +0000 Subject: [PATCH] LP#1849212 Create, Edit and Delete Functionality Added the create, edit, and delete functionality. Signed-off-by: Zavier Banks --- .../course-reserves/course-list.component.html | 3 +- .../course-reserves/course-list.component.ts | 34 ++++++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.html index e48c240892..471a94e02f 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.html @@ -2,6 +2,7 @@ + @@ -18,7 +19,7 @@ - + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.ts index bd72c5219a..9e4bb40878 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.ts @@ -37,15 +37,15 @@ export class CourseListComponent implements OnInit { ){} ngOnInit() { - this.getSource(); - this.rowFlair(); + this.getSource(); + this.rowFlair(); } /** * Gets the data, specified by the class, that is available. */ getSource() { - this.grid_source.getRows = (pager: Pager, sort: any[]) => { + this.grid_source.getRows = (pager: Pager, sort: any[]) => { const orderBy: any = {}; if (sort.length) { // Sort specified from grid @@ -120,14 +120,30 @@ export class CourseListComponent implements OnInit { ); } - editSelected(standingPenaltyFields: IdlObject[]) { + editSelected(fields: IdlObject[]) { // Edit each IDL thing one at a time - const editOneThing = (standingPenalty: IdlObject) => { - if (!standingPenalty) { return; } - this.showEditDialog(standingPenalty).then( - () => editOneThing(standingPenaltyFields.shift())); + const editOneThing = (field_object: IdlObject) => { + if (!field_object) { return; } + this.showEditDialog(field_object).then( + () => editOneThing(fields.shift())); }; - editOneThing(standingPenaltyFields.shift()); + editOneThing(fields.shift()); } + + deleteSelected(idl_object: IdlObject[]) { + idl_object.forEach(idl_object => idl_object.isdeleted(true)); + this.pcrud.autoApply(idl_object).subscribe( + val => { + console.debug('deleted: ' + val); + this.deleteSuccessString.current() + .then(str => this.toast.success(str)); + }, + err => { + this.deleteFailedString.current() + .then(str => this.toast.danger(str)); + }, + () => this.grid.reload() + ); + }; } -- 2.11.0