</eg-staff-banner>
<eg-string #successString i18n-text text="{{table_name}} Update Succeeded"></eg-string>
+<eg-string #createString i18n-text text="{{table_name}} Was Created Successfully"></eg-string>
<eg-string #deleteFailedString i18n-text text="Delete of {{table_name}} failed or was not allowed"></eg-string>
<eg-string #deleteSuccessString i18n-text text="Delete of {{table_name}} succeeded"></eg-string>
<eg-string #flairTooltip i18n-text text="Limited Editing"></eg-string>
</eg-grid-toolbar-button>
<eg-grid-toolbar-action label="Edit Selected" i18n-label (onClick)="editSelected($event)">
</eg-grid-toolbar-action>
- <eg-grid-toolbar-action label="Delete Selected" i18n-label>
+ <eg-grid-toolbar-action label="Delete Selected" i18n-label (onClick)="deleteSelected($event)">
</eg-grid-toolbar-action>
</eg-grid>
</div>
){}
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
);
}
- 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()
+ );
+ };
}