<field reporter:label="Course Members" name="members" oils_persist:virtual="true" reporter:datatype="link" />
<field reporter:label="Course Materials" name="materials" oils_persist:virtual="true" reporter:datatype="link" />
<field reporter:label="Non-Cataloged Course Materials" name="non_cat_materials" oils_persist:virtual="true" reporter:datatype="link" />
+ <field reporter:label="Is Archived?" name="is_archived" reporter:datatype="boolean" />
</fields>
<links>
<link field="owning_lib" reltype="has_a" key="id" map="" class="aou" />
<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 #deleteSucailedString i18n-text text="Delete of {{table_name}} failed or was not allowed"></eg-string>
+<eg-string #archiveFailedString i18n-text text="Archival of {{table_name}} failed or was not allowed"></eg-string>
+<eg-string #archiveSuccessString i18n-text text="Archival of {{table_name}} succeeded"></eg-string>
<eg-string #flairTooltip i18n-text text="Limited Editing"></eg-string>
<eg-course-associate-material-dialog #courseMaterialDialog>
</eg-grid-toolbar-action>
<eg-grid-toolbar-action label="Delete Selected" i18n-label (onClick)="deleteSelected($event)">
</eg-grid-toolbar-action>
+ <eg-grid-toolbar-action label="Archive Selected" i18n-label (onClick)="archiveSelected($event)">
+ </eg-grid-toolbar-action>
</eg-grid>
</div>
<eg-fm-record-editor #editDialog
idlClass={{idl_class}}
- [preloadLinkedValues]="true">
+ [preloadLinkedValues]="true"
+ hiddenFields="is_archived,id">
</eg-fm-record-editor>
@ViewChild('updateFailedString', { static: false }) updateFailedString: StringComponent;
@ViewChild('deleteFailedString', { static: true }) deleteFailedString: StringComponent;
@ViewChild('deleteSuccessString', { static: true }) deleteSuccessString: StringComponent;
+ @ViewChild('archiveFailedString', { static: true }) archiveFailedString: StringComponent;
+ @ViewChild('archiveSuccessString', { static: true }) archiveSuccessString: StringComponent;
@ViewChild('courseMaterialDialog', {static: true})
private courseMaterialDialog: CourseAssociateMaterialComponent;
@Input() sort_field: string;
editOneThing(fields.shift());
}
+ archiveSelected(course: IdlObject[]) {
+ this.courseSvc.disassociateMaterials(course).then(res => {
+ course.forEach(course => {
+ console.log(course);
+ course.is_archived(true);
+ });
+ this.pcrud.update(course).subscribe(
+ val => {
+ console.debug('archived: ' + val);
+ this.archiveSuccessString.current()
+ .then(str => this.toast.success(str));
+ }, err => {
+ this.archiveFailedString.current()
+ .then(str => this.toast.danger(str));
+ }, () => {
+ this.grid.reload();
+ }
+ );
+ });
+ }
+
deleteSelected(idl_object: IdlObject[]) {
this.courseSvc.disassociateMaterials(idl_object).then(res => {
- console.log(res);
idl_object.forEach(idl_object => {
idl_object.isdeleted(true)
});
name TEXT NOT NULL,
course_number TEXT NOT NULL,
section_number TEXT,
- owning_lib INT REFERENCES actor.org_unit (id)
+ owning_lib INT REFERENCES actor.org_unit (id),
+ is_archived BOOLEAN DEFAULT false
);
CREATE TABLE asset.course_module_course_users (
name TEXT NOT NULL,
course_number TEXT NOT NULL,
section_number TEXT,
- owning_lib INT REFERENCES actor.org_unit (id)
+ owning_lib INT REFERENCES actor.org_unit (id),
+ is_archived BOOLEAN NOT NULL DEFAULT false;
);
CREATE TABLE asset.course_module_course_users (